How to use the CSS border-spacing property

不言
Release: 2018-11-29 09:23:13
Original
3254 people have browsed it

The border-spacing property is used to specify the border of adjacent cells and the spacing between the borders. The border-spacing property is only effective when the value of the border-collapse property is separate. This article will introduce to you the usage of CSS border-spacing attribute. Let’s take a look at the specific content.

How to use the CSS border-spacing property

Let’s first take a look at What is the border-spacing attribute in CSS?

The border-spacing property specifies the spacing between the edges of adjacent cells of the table border.

However, it only works when separate is specified using border-collapse.

Let’s look at a specific example

HTML code

<div class="demo">
<table>
<tr>
<td>文字内容</td>
<td>文字内容</td>
</tr>
<tr>
<td>文字内容</td>
<td>文字内容</td>
</tr>
</table>
</div>
Copy after login

CSS code

.demo table {
  border: 2px solid #0000000;
  border-collapse: separate;
  border-spacing: 15px;
}
.demo table td {
  border: 2px solid #d49fc2;
}
Copy after login

is displayed on the browser The effect is as follows: the spacing between cells appears.

How to use the CSS border-spacing property

If you change the value of the border-spacing attribute to 50px, the effect displayed on the browser is as follows, and the spacing between adjacent cells will become larger.

How to use the CSS border-spacing property

This article ends here. For more exciting content about CSS, you can go to the CSS video on the php Chinese website Tutorial Learn further! ! !

The above is the detailed content of How to use the CSS border-spacing property. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template