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:none;}
2、再设置 td 的 CSS 为{border:solid #000 1px;}
本文为原创文章,版权归主机之家测评所有,欢迎分享本文,转载请保留出处!