Css using the control table cellpadding cellspacing and properties

There is a gap between the default HTML table styles, each time in order to solve these problems, we want to add in the table cellspacing and cellpadding tag, if you are very tired of this writing,

Then there is no corresponding CSS properties to achieve the same effect?

1 <table cellspacing=0 cellpadding=0>
2 </table>

The answer is yes, cellspacing attribute table corresponding to the border-spacing CSS property, but the property corresponds padding cellpadding attribute of td

1 table{
2     border-spacing:0;  
3 }
4 td{
5     padding:0;  
6 }

There are many CSS properties table control, such as table-layout, border-collaspse

If you use multiple table layouts, found that the width of the border due to the alignment problem, you can use the box-sizing property, it is set to border-box on it, the box model will calculate the time a border, are the property IE8 + the support, Firefox requires the prefix way -moz-box-sizing.

Come and try it.

 

Reproduced in: https: //www.cnblogs.com/jamesldj/p/3256525.html

Guess you like

Origin blog.csdn.net/weixin_34190136/article/details/93770977