css表格
表格边框
table, th, td
{
border: 1px solid black;
}
表格宽度和高度
table
{
width:100%;
}
th
{
height:50px;
}
表格文字对齐
td
{
text-align:right;
}
表格填充
如果在表的内容中控制空格之间的边框,应使用td和th元素的填充属性:
td
{
padding:15px;
}
表格颜色
下面的例子指定边框的颜色,和th元素的文本和背景颜色:
实例
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}