CSS ???
CSS ???
CSS? ???? HTML ???? ??? ?? ???? ? ????.
CSS ??? ??
CSS ??? ??? ???? ??? ?? ???? ? ??? ???.
??? ???
CSS?? ??? ???? ????? ??? ??? ?????.
?? ???? ??? th ? td? ??? ???? ?????.
table, th, td
{
border: 1px Solid Blue ;
}
? ?? ??? ??? ???? ????. ?? table, th ? td ??? ???? ???? ?? ?????.
?? ? ?? ???? ????? border-collapse ??? ?????.
??? ??
border-collapse ??? ???? ???? ?? ???? ??? ??? ???? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> table { border-collapse: collapse; } table, td, th { border: 1px solid black; } </style> </head> <body> <table> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td>Peter</td> <td>Griffin</td> </tr> <tr> <td>Lois</td> <td>Griffin</td> </tr> </table> <p><b>注意;</b> 如果沒有指定 !DOCTYPE border-collapse 屬性在 IE8 及更早 IE 版本中是不起作用的。</p> </body> </html>
??? ?? ? ??
Width ? height ??? ???? ??? ??? ?????.
?? ?? ??? 100%? ???? ??? ??? 50??? ??? ????.
table { width:100%; } th { height:50px; }
? ??? ??
???? ??? ?? ? ?? ?? ?????.
text-align屬性設(shè)置水平對齊方式,像左,右,或中心: td{text-align:right;}
?? ?? ??? ??, ??? ?? ??? ?? ?? ??? ?????.
td { height:50px; vertical-align:bottom; }
??? ???
If in ??? ???? ?? ??? ??? ????? td ? th ??? ?? ??? ???? ???.
td { padding:15px; }
??? ??
?? ???? ??? ??? ?? ??? ??? ? ?? ??? ?????
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> table, td, th { border:1px solid blue; } th { background-color:pink; color:white; } </style> </head> <body> <table> <tr> <th>Firstname</th> <th>Lastname</th> <th>Savings</th> </tr> <tr> <td>Peter</td> <td>Griffin</td> <td>0</td> </tr> <tr> <td>Lois</td> <td>Griffin</td> <td>0</td> </tr> <tr> <td>Joe</td> <td>Swanson</td> <td>0</td> </tr> <tr> <td>Cleveland</td> <td>Brown</td> <td>0</td> </tr> </table> </body> </html>