html5的表格边框怎么表示实线

html5的表格边框怎么表示实线,第1张

<style type="text/css">

<!--

.tableborder {

border-top-width: 1px

border-right-width: 1px

border-bottom-width: 1px

border-left-width: 1px

/*以上分别设置的是表格边框中上右下左的边框宽度*/

border-top-style: solid

border-right-style: solid

border-bottom-style: solid

border-left-style: solid

/*设置边框的表现样式,solid为实线*/

border-top-color: #0000FF

border-right-color: #0000FF

border-bottom-color: #0000FF

border-left-color: #0000FF

/*设置边框的颜色*/

}

-->

</style>

<table width="300" height="100" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">

<tr>

<td>class="tableborder"是对样式的调用,写在table标签内</td>

<td></td>

</tr>

</table>

html中如果设置table的border为1px,实际会产生双线,十分不美观,那么在HTML中如何正确设置表格table边框border呢?

第一种方法

1、将table的属性设置为:BORDER=0 、cellspacing=1 ;

2、设置table的背景色为即你要设置的table的边框颜色;

3、设置所有td背景色为#ffffff白色;

第二种方法:

1、设置BORDER=0 ;

2、再通过CSS,给Table加上1px的border-top,border-left;

3、然后再设置所有的td的border-right,border-bottom;

第三种方法(推荐):

1、设置table的CSS为{border-collapse:collapseborder-style: solidborder-width: 1px}

注:border-collapse:collapse

separate默认值。边框会被分开。不会忽略 border-spacing 和 empty-cells 属性。

collapse如果可能,边框会合并为一个单一的边框。会忽略 border-spacing 和 empty-cells 属性。

inherit 规定应该从父元素继承 border-collapse 属性的值。

2、再设置td的CSS为{border-style: solidborder-width: 1px}

转自: https://www.cnblogs.com/qq2806933146xiaobai/p/12407749.html


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6119863.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-15
下一篇 2023-03-15

发表评论

登录后才能评论

评论列表(0条)

保存