Home >Web Front-end >CSS Tutorial >What does collapse mean in css

What does collapse mean in css

WBOY
WBOYOriginal
2021-12-22 15:31:118860browse

collapse in css means "merging borders". The "border-collapse" attribute is used to set whether the borders between tables are merged. When the value of the attribute is "collapse", it means that the borders will be merged. The syntax is "element {border-collapse:collapse;}".

What does collapse mean in css

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

What does collapse mean in css?

The border-collapse property in CSS is used to set whether table borders are merged. It has three values. Among them, separate means separating borders, collapse means merging borders, and inherit means inheriting attributes from the parent.

When making a table, we can use the border-collapse attribute to merge the two borders into one, making the border effect more beautiful. Beautiful.

The border-collapse property sets whether the table's borders are collapsed into a single border, or displayed separately as in standard HTML.

The example is as follows:

<html>
<head>
<style type="text/css">
table{
  border-collapse:collapse;
  }
table, td, th{
  border:1px solid black;
  }
</style>
</head>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Bill</td>
<td>Gates</td>
</tr>
<tr>
<td>Steven</td>
<td>Jobs</td>
</tr>
</table>
<p><b>注释:</b>如果没有规定 !DOCTYPE,border-collapse 属性可能会引起意想不到的错误。</p>
</body>
</html>

Output result:

What does collapse mean in css

(Learning video sharing: css video tutorial)

The above is the detailed content of What does collapse mean in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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