【css】table-border样式小结

关于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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值