简单整理一下今天学习的表格设计
table:表格
tr:行
th:列
td:表头(默认加粗)
border属性:边框,主要属性包括:border-style(线性)、border-width、border-color;
vertical-align:单元格文字位置:top,bottom,right,left;
tr:hover{background-color:red} :鼠标悬停变化;
padding:内边距
tr:nth-child(oven){background-color:red}:偶数行表格背景颜色设置,ven可改动
源码如下:
<html>
<head>
<title>表格效果</title>
<style>
table{
border-collapse: collapse;
}
table{
width: 100%
}
table, th,tr,td{
border-width: 10px;
border-color: blue;
border-style:dashed;
text-align: center;
background-color: aquamarine;
padding: 50px;
}
tr:hover{background-color:pink;}
</style>
</head>
<body>
<div>
<table>
<tr>
<th>姓名</th>
<th>学号</th>
</tr>
<tr>
<td>xmc</td>
<td>2018</td>
</tr>
<tr>
<td>wjl</td>
<td>2019</td>
</tr>
</table>
</div>
</body>
</html>
效果图如下: