关于table这个tag
内嵌标签: thead(可选)、tbody(可选)、td、tr、colgroup 、caption(可选)
属性:align ,bgcolor ,bordercolor,border ,cellpadding ,cellspacing ,frame ,width ,summary ,rules 。
现在的table的属性基本已经过时,都使用css进行设置table样式。
关于table的css
1.border-collapse collapse | separate
collapse : border线合并
separate: border线分隔,默认属性
ps: 使用collapse 此属性时, border-spacing 、empty-cells和 border-radius 失效,无任何效果。
2.border-spacing horizontal < length > | vertical < length >
table {
border-collapse:separate;
border-spacing:0;
width:50%;
}
td { border:1px solid #000 }
/** tr hover设置td样式 **/
table tr:hover td {
cursor: default;
background-color: #ccc;
border:1px solid red;
}
3.vertical-align 设置内容与图片位置
4.table-layout auto | fixed
ps: auto 表格布局自适应宽度
fixed 表格布局固定宽度,文字内容等可能会溢出
5.caption-side 针对于caption标签的css样式设置
6.empty-cells 但单元格内无内容时候,可设置隐藏
参考:
https://www.sitepoint.com/community/t/table-format-using-css-border-issue/36882/3
https://css-tricks.com/almanac/properties/b/border-collapse/
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Table