Home >Web Front-end >CSS Tutorial >Two ways to achieve a 1px thin border using border-spacing and cellspacing in CSS
After learning table, I will find two borders every time, which does not look pleasing to the eye. If the border is set to 0, it is not good. So how to make a table with thin borders? It is about 1px. After consulting relevant information, I found 2 ways to solve this problem, as follows:
The first method:
#message{border-collapse:collapse;border:1px solid red;} #message th,#message td{border:1px solid red;} <table id=”message”> <tr> <th>出生年月</th> <td>1989年1月22号</td> </tr> <tr> <th>性别</th> <td>男</td> </tr></table>
Second method:
#message{border-spacing:1px;background:red;} #message tr{background:purple;} .......... .............. ................
The above is the detailed content of Two ways to achieve a 1px thin border using border-spacing and cellspacing in CSS. For more information, please follow other related articles on the PHP Chinese website!