CSS 4.6 样式-表格

CSS 4.6 样式-表格

 

1.表格边框border属性

这里的border是简写属性,即将border-widthborder-styleborder-color写在一起

例如:table, th, td  {  border: 1px solid blue;  }

注:有先后顺序,但可以省略某个table, th, td  {  border: 1px blue;  }

具体参见CSS手册CSS边框属性

 

2.边框折叠border-collapse属性

可能的值:

separate ['sepəreit]分离),默认值,边框分开,有两个边框

collapse [kə'læps]折叠),边框合并为一个,会忽略border-spacingempty-cells

 

3.表格宽度和高度widthheight

可能的值:数值(px···)或百分比(%)或auto或继承

例如:table { width100%}

      th {height50px}

注:width(表格宽)与border-width(线宽)不同

 

4.对齐,水平方向(左右中对齐)text-align,竖直方向(顶底中对齐)vertical-align

可能的值:

text-alignleft right center

vertical-aligntop bottom center

例如:

td {

  text-alignleft

  vertical-aligncenter

}

 

5.表格颜色

 

边框颜色border-color

文本颜色color

背景颜色background-color绿

 

6.内边距(字与边框)padding15px

7.单元格边框距离border-spacing5px

8.隐藏表格中空单元格上的边框和背景empty-cells

可能的值:

show:默认,在空单元格周围绘制边框。

hide:不在空单元格周围绘制边框。

 

 

9.表格布局table-layout(就是列宽,layout布局排版)

可能的值:

automatic,默认,自动布局,列宽由内容决定。

fixed,固定布局,自己设定

例如1

table-layoutautomatic

结果:

 

例如2

<html>

<head><style type=text/css>

   table.fixed { table-layoutfixed}

</style></head>

<body>

<table class=fixedwidth=100%>

<tr>

<td width=20%>10000000000000000</td>

<td width=40%>10000000</td>

<td width=40%>100</td>

</tr>

</table>

</body>

</html>

结果:

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值