Home > Article > Web Front-end > 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!