点评:常见的CSS表格样式有圆角、隔行、变色等等,下面有个不错的示例,感兴趣的朋友可以参考下
先看效果图:
7GuHTML5中文学习网 - HTML5先行者学习网
7GuHTML5中文学习网 - HTML5先行者学习网CSS:
7GuHTML5中文学习网 - HTML5先行者学习网 7GuHTML5中文学习网 - HTML5先行者学习网
<style type="text/css"> 7GuHTML5中文学习网 - HTML5先行者学习网
table { 7GuHTML5中文学习网 - HTML5先行者学习网
max-width: 100%; 7GuHTML5中文学习网 - HTML5先行者学习网
background-color: transparent; 7GuHTML5中文学习网 - HTML5先行者学习网
border-collapse: collapse; 7GuHTML5中文学习网 - HTML5先行者学习网
border-spacing: 0; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table { 7GuHTML5中文学习网 - HTML5先行者学习网
width: 100%; 7GuHTML5中文学习网 - HTML5先行者学习网
margin-bottom: 18px; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table th, .table td { 7GuHTML5中文学习网 - HTML5先行者学习网
padding: 8px; 7GuHTML5中文学习网 - HTML5先行者学习网
line-height: 18px; 7GuHTML5中文学习网 - HTML5先行者学习网
text-align: left; 7GuHTML5中文学习网 - HTML5先行者学习网
vertical-align: top; 7GuHTML5中文学习网 - HTML5先行者学习网
border-top: 1px solid #dddddd; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table th { 7GuHTML5中文学习网 - HTML5先行者学习网
font-weight: bold; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table thead th { 7GuHTML5中文学习网 - HTML5先行者学习网
vertical-align: bottom; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table caption + thead tr:first-child th, .table caption + thead tr:first-child td, .table colgroup + thead tr:first-child th, .table colgroup + thead tr:first-child td, .table thead:first-child tr:first-child th, .table thead:first-child tr:first-child td { 7GuHTML5中文学习网 - HTML5先行者学习网
border-top: 0; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table tbody + tbody { 7GuHTML5中文学习网 - HTML5先行者学习网
border-top: 2px solid #dddddd; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-condensed th, .table-condensed td { 7GuHTML5中文学习网 - HTML5先行者学习网
padding: 4px 5px; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-bordered { 7GuHTML5中文学习网 - HTML5先行者学习网
border: 1px solid #dddddd; 7GuHTML5中文学习网 - HTML5先行者学习网
border-collapse: separate; 7GuHTML5中文学习网 - HTML5先行者学习网
*border-collapse: collapsed; 7GuHTML5中文学习网 - HTML5先行者学习网
border-left: 0; 7GuHTML5中文学习网 - HTML5先行者学习网
-webkit-border-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
-moz-border-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
border-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-bordered th, .table-bordered td { 7GuHTML5中文学习网 - HTML5先行者学习网
border-left: 1px solid #dddddd; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-bordered caption + thead tr:first-child th, .table-bordered caption + tbody tr:first-child th, .table-bordered caption + tbody tr:first-child td, .table-bordered colgroup + thead tr:first-child th, .table-bordered colgroup + tbody tr:first-child th, .table-bordered colgroup + tbody tr:first-child td, .table-bordered thead:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child td { 7GuHTML5中文学习网 - HTML5先行者学习网
border-top: 0; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-bordered thead:first-child tr:first-child th:first-child, .table-bordered tbody:first-child tr:first-child td:first-child { 7GuHTML5中文学习网 - HTML5先行者学习网
-webkit-border-top-left-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
border-top-left-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
-moz-border-radius-topleft: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-bordered thead:first-child tr:first-child th:last-child, .table-bordered tbody:first-child tr:first-child td:last-child { 7GuHTML5中文学习网 - HTML5先行者学习网
-webkit-border-top-right-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
border-top-right-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
-moz-border-radius-topright: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-bordered thead:last-child tr:last-child th:first-child, .table-bordered tbody:last-child tr:last-child td:first-child { 7GuHTML5中文学习网 - HTML5先行者学习网
-webkit-border-radius: 0 0 0 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
-moz-border-radius: 0 0 0 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
border-radius: 0 0 0 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
-webkit-border-bottom-left-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
border-bottom-left-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
-moz-border-radius-bottomleft: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-bordered thead:last-child tr:last-child th:last-child, .table-bordered tbody:last-child tr:last-child td:last-child { 7GuHTML5中文学习网 - HTML5先行者学习网
-webkit-border-bottom-right-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
border-bottom-right-radius: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
-moz-border-radius-bottomright: 4px; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table-striped tbody tr:nth-child(odd) td, .table-striped tbody tr:nth-child(odd) th { 7GuHTML5中文学习网 - HTML5先行者学习网
background-color: #f9f9f9; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
.table tbody tr:hover td, .table tbody tr:hover th { 7GuHTML5中文学习网 - HTML5先行者学习网
background-color: #f5f5f5; 7GuHTML5中文学习网 - HTML5先行者学习网
} 7GuHTML5中文学习网 - HTML5先行者学习网
</style> 7GuHTML5中文学习网 - HTML5先行者学习网
7GuHTML5中文学习网 - HTML5先行者学习网再看表格引用:
7GuHTML5中文学习网 - HTML5先行者学习网 7GuHTML5中文学习网 - HTML5先行者学习网
<table class="table table-bordered table-striped "> 7GuHTML5中文学习网 - HTML5先行者学习网
<thead> 7GuHTML5中文学习网 - HTML5先行者学习网
<tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<th width="30"> <input type="checkbox" name="ckall" id="ckall" /> 7GuHTML5中文学习网 - HTML5先行者学习网
</th> 7GuHTML5中文学习网 - HTML5先行者学习网
<th width="40"> ID号 </th> 7GuHTML5中文学习网 - HTML5先行者学习网
<th width="80"> 编码 </th> 7GuHTML5中文学习网 - HTML5先行者学习网
<th> 名称 </th> 7GuHTML5中文学习网 - HTML5先行者学习网
<th> 用户密码 </th> 7GuHTML5中文学习网 - HTML5先行者学习网
<th width="60"> 管理员否 </th> 7GuHTML5中文学习网 - HTML5先行者学习网
<th width="55"> 操作 </th> 7GuHTML5中文学习网 - HTML5先行者学习网
</tr> 7GuHTML5中文学习网 - HTML5先行者学习网
</thead> 7GuHTML5中文学习网 - HTML5先行者学习网
<tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><input type="checkbox" name="c_id" value="a" /></td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>1</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>awinlau</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 胡光光</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> awin</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 管理员 </td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><a href="#" class="btn btn-mini"><i class="icon-edit"> </i>编辑</a></td> 7GuHTML5中文学习网 - HTML5先行者学习网
</tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><input type="checkbox" name="c_id" value="a" /></td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>2</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>hugge</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 刘若英</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> test</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 管理员 </td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><a href="#" class="btn btn-mini"><i class="icon-edit"> </i>编辑</a></td> 7GuHTML5中文学习网 - HTML5先行者学习网
</tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><input type="checkbox" name="c_id" value="a" /></td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>3</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>awinlau</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 胡光光</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> awin</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 管理员 </td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><a href="#" class="btn btn-mini"><i class="icon-edit"> </i>编辑</a></td> 7GuHTML5中文学习网 - HTML5先行者学习网
</tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<tr> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><input type="checkbox" name="c_id" value="a" /></td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>4</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td>awinlau</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 胡光光</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> awin</td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td> 管理员 </td> 7GuHTML5中文学习网 - HTML5先行者学习网
<td><a href="#" class="btn btn-mini"><i class="icon-edit"> </i>编辑</a></td> 7GuHTML5中文学习网 - HTML5先行者学习网
</tr> 7GuHTML5中文学习网 - HTML5先行者学习网
</table> 7GuHTML5中文学习网 - HTML5先行者学习网