
<table width="600" height="200" align="center" style="border-left:#b22222 1px ridge;border-top:#b22222 1px ridge;">
<tr>
<td valign="top" style="padding-top:5px;padding-left:3px;"><img src="pugongyingjpg" width="100" height="100" /></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:collapse;border-style: solid;border-width: 1px;}
注:border-collapse:collapse;
separate 默认值。边框会被分开。不会忽略 border-spacing 和 empty-cells 属性。
collapse 如果可能,边框会合并为一个单一的边框。会忽略 border-spacing 和 empty-cells 属性。
inherit 规定应该从父元素继承 border-collapse 属性的值。
2、再设置td的CSS为{border-style: solid;border-width: 1px;}
转自: https://wwwcnblogscom/qq2806933146xiaobai/p/12407749html
2楼:
dashed常量不是所有浏览器都支持的,而且也没说要用虚线
改solid比较好
<style type="text/css">
td{
border:2px solid #000;
}
</style>
如果不够粗,把2改更大的数字就行了
<table width="输入数值就是表格的宽度" height="输入数值就是表格的高度" border="输入数值就是表格边框的大小">
比如
<table width="300" height="500" border="2">
</table>
望采纳
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)