什么是table标签?
table标签可以用于制表,table标签内只能包含三个标签:thead、tbody、tfoot。
其中thead和tfoot可有可无,而tbody没有的话也会自动纠错后生成tbody。
thead、tbody、tfoot可以无序编写,系统会根据head、body、foot自动排序。
表格的标签及其属性介绍
tr(table row):指新建一行
th(table head):指表头
td(table data):指数据
例1:
<body>
<table>
<tr>
<th>英语</th>
<th>翻译</th>
</tr>
<tr>
<td>hyper</td>
<td>超级</td>
</tr>
<tr>
<td>food</td>
<td>食物</td>
</tr>
</table>
</body>
效果:
table的样式:
需在style内设置
table-layout:
自动对齐表格
table-layout:auto
根据表格宽度设置表格:
table-layout:fixed
table-collapse:
表格边框合并起来:
border-collaps
table-spacing:
表格数据各边界间距:
border-spacing:20px
表格分割线宽度:
border:1px