Home  >  Article  >  Web Front-end  >  What properties are used to set CSS table borders?

What properties are used to set CSS table borders?

(*-*)浩
(*-*)浩Original
2019-11-28 14:29:395282browse

What properties are used to set CSS table borders?

Table border

If you need to set the table border in CSS, please use the border attribute. (Recommended learning: CSS Introduction Tutorial)

The following example sets blue borders for table, th and td:

<html>
<head>
<style type="text/css">
table,th,td
{
border:1px solid blue;
}
</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>
</body>
</html>

Note that the table in the example above has a double line border. This is because the table, th and td elements have independent borders.

If you need to display the table as a single line border, please use the border-collapse attribute.

The above is the detailed content of What properties are used to set CSS table borders?. 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