1:表格边框
table, th, td
{
border: 1px solid blue;
}
2:折叠边框
border-collapse 属性设置是否将表格边框折叠为单一边框
table
{
border-collapse:collapse;
}
table,th, td
{
border: 1px solid black;
}
3:表格宽度和高度
通过 width 和 height 属性定义表格的宽度和高度。
table
{
width:100%;
}
th
{
height:50px;
}
4:表格文本对齐
table,td,th
{
border:1px solid black;
}
td
{
text-align:right;
}
vertical-align 属性设置垂直对齐方式,比如顶部对齐、底部对齐或居中对齐:
table, td, th
{
border:1px solid black;
}
td
{
height:50px;
vertical-align:bottom;
}
5:表格颜色
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
6: caption-side设置表格标题的位置。
7:empty-cells设置是否显示表格中的空单元格。
8:table-layout设置显示单元、行和列的算法。
table.one
{
table-layout: automatic
}
table.two
{
table-layout: fixed
}