簡寫背景屬性
background:顏色 圖片路徑 居中 不重復 固定 (沒有 順序和數(shù)量要求 沒設置的就使用默認值)
執(zhí)行下邊的 background寫下邊 會給上邊的background-color 覆蓋
網(wǎng)頁中設計表格
th 表頭便簽 居中 加粗
tr 行 不是table的直接后代 是孫子
td 列
style type=text/css
table{
margin:0 auto;
width:300px;
barder:1px slid black;
border-spacing:0px; 沒有間距 一條線 兩像素 合并
border-collapse:collapse;一像素 只留td邊框 邊框合并 td的邊框就失效了 沒有意義了
}
th,td{
border:1px solid black
} 都給設上
表格的標簽
<table>
<tr> 代表行
<td >代表列A1</td>
<td rowspan=2>A2</td>縱向合并2個
</tr>
</table>
設置背景
ie8不支持 需要兼容的 ie9以上的都支持
給奇數(shù)行的設置顏色 even偶數(shù)c
tr:nth-child(odd){
background-color:#f5f5f5
}
鼠標移入變顏色
ie6不好使 ie9以上的都支持
tr:hover{
background-color:yellow
}
長表格 表頭 主體 底部
<table>
<thead>
<tr>
<th>薪資</th>
</tr>
<thead>
<tbody>
<tr>
<td>80000</td>
</tr>
<tbody>
<tfoot>
<tr
<td></td>
<td></td>
<td>剩余</td>
<tr>
<tfoot>
<table>
設置寬高
<table border="1" width="100%">
<tr height="100px">
<td></td>
</tr>
<tr height="500px">
<td></td>
</tr>
<tr height="100px">
<td></td>
</tr>
</table>
表格可以嵌套的
td 里可以在加表格的 可以一給嵌套的表格在設置寬 高
完善
父子元素重疊 外邊距重疊
.box1:before{
content:" ";
display:table;
clear:both;
}
高度塌陷
.clearfix:after{
content:" ";
display:table;
clear:both;
}