Sunday, April 22, 2007

CSS and cellspacing=0 cellpadding=0

Very often webmasters use following HTML code for tables to remove free spacing between cells and clear padding within cell.


<table border=0 cellspacing=0 cellpadding=0>
….


Also this code sets zero for border property making it invisible. As alternative way you can use CSS instead pure HTML code to rule table visualization properties. This CSS code remove free spacing and between cells and remove padding within cell for all tables in your html document.


<STYLE type="text/css">


table {
border-collapse : collapse;
}

table td, table th {
padding : 0;
}

</STYLE>


I recommend very nice tool - HTML and CSS Table Border Style Wizard

0 Comments:

Post a Comment

<< Home