Not logged in - Login

cellpadding=0 and cellspacing=0 replacement for html5

HTML 5 does not have the cellpadding or cellspacing attributes as part of the table element.

This is how to do the same using CSS / Stylesheets:

<style type="text/css">
   //CSS Replacement for cellpadding='0':
   table
   { 
       border-spacing:0;
       border-collapse:collapse;
   }

   // CSS Replacement for cellspacing='0':
   table td, table th
   {
       padding: 0;
   }
</style>

Same example as above, using a named class for the table.

<style type="text/css">
   /* CSS Replacement for cellpadding='0': */ 
   table.MyTestClass
   {
       background-color: #FFFF00;
       border-spacing: 0;
       border-collapse: collapse;
   }

   /* CSS Replacement for cellspacing='0': */
   table.MyTestClass td
   {
       padding: 0;
       vertical-align: top;
   }

   /* CSS Replacement for cellspacing='0': */ 
   table.MyTestClass th
   {
       padding: 0;
       vertical-align: top;
   }
</style>