This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23545|Reply: 3

[CSS/DIV] HTML trick to change the table border to a thin line

[Copy link]
Posted on 4/18/2015 10:19:21 PM | | | |

When using TABLE tables, beginners in HTML production will encounter how to change the edge thickness, because the default TABLE edge setting is very thick even if it is 1px. Therefore, there are other methods used to create thin line borders, and here is a method of using CSS to implement thin lines, which is very effective and compatible with all browsers.

If you simply set the border for a thin line table, it is difficult to ensure that the browser is compatible. A common practice is to utilize CSS2's "border-collapse:collapse;" attribute merge table borders; And set the left and top borders for table elements, and the right and bottom borders for th and td elements.

HTML:

<table>     <tr>         <th>table head (row1, col1)</th>         <th>table head (row1, col2)</th>         <th>table head (row1, col3)</th>     </tr>     <tr>         <td>table data (row1, col1)</td>         <td>table data (row1, col2)</td>         <td>table data (row1, col3)</td>     </tr>     <tr>         <td>table data (row2, col1)</td>         <td>table data (row2, col2)</td>         <td>table data (row2, col3)</td>     </tr>
</table>CSS:

table{border-collapse:collapse; border-spacing:0; border-left:1px solid #888; border-top:1px solid #888; background:#efefef; }
th,td{border-right:1px solid #888; border-bottom:1px solid #888; padding:5px 15px; }
th{font-weight:bold; background:#ccc; }




Previous:How do I use code to make the authentication control unavailable in Asp.Net?
Next:Session's lifecycle
Posted on 7/15/2015 1:06:57 AM |
Check out the support
 Landlord| Posted on 3/11/2021 10:51:40 AM |
Renderings:



Code:



Posted on 4/3/2021 12:04:18 AM |
Thanks for sharing! Thanks for sharing!
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com