Home > Article > Web Front-end > How to remove table borders in css
Removal method: 1. Add "border:0;" style to table, th, and td elements; 2. Add "border-style:none;" style to table, th, and td elements; 3. Add "border:transparent;" style to table, th, and td elements.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
Here is an HTML document with a table
<table border="1"> <tr> <th>姓名</th> <th>年龄</th> </tr> <tr> <td>Peter</td> <td>20</td> </tr> <tr> <td>Lois</td> <td>20</td> </tr> </table>
It can be seen that the table has a border, so what should I do if I want to remove the table border? Here are several methods.
Method 1: Add border: 0;
Style
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> table,th,td { border: 0; } </style> </head> <body> <table border="1"> <tr> <th>姓名</th> <th>年龄</th> </tr> <tr> <td>Peter</td> <td>20</td> </tr> <tr> <td>Lois</td> <td>20</td> </tr> </table> </body> </html>
Rendering:
Method 2: Add border-style: none;
style to table, th, td elements
<style> table,th,td { border-style: none; } </style>
Method 3: Add border: transparent;
style
<style> table,th,td { border: transparent; } </style>
( Learning video sharing: css video tutorial)
The above is the detailed content of How to remove table borders in css. For more information, please follow other related articles on the PHP Chinese website!