个人笔记:html中table属性最常用属性

align与valign()

align——表示左右居中——left,center,right

valign——控制上下居中——left,center,righ

表格单元格里面内容居中:

(1)tex-align:表格单元格里内容居中

(2)<table align=”center”>表格居中or在css中设置table{margin:auto}(块元素一般使用这种方法都可以使其居中)

<table style=”text-align:center”>

或者在css设置td{ text-align:center }

表格单元格里面内容垂直居中:

<table style=”line-height:单元格的高度”>

或者在css设置td{   line-height:单元格的高度 }

 

<caption align=”bottom”>标题显示在底部or在css中设置caption-side:bottom;

Rowspan:跨行 colspan:跨列

Cellpadding: 表格内的文字至四周边框的距离   cellspacing:表框宽度

border-collapse:collapse:表格边框线合并

注意:tr标签里面的width设置不起任何作用

td标签里面的width和height都是起作用的

 

边框颜色的设置:一般只能在css中用 table td{ border:red}

(区分表边框和单元格边框)

订阅评论
提醒
0 评论
内联反馈
查看所有评论
0
希望看到您的想法,请您发表评论x