Deprecated cellspacing and cellpadding

If you're building your sites using XHTML or HTML5 you should not be using cellspacing and cellpadding in your tables.

In fact you should not be using tables for building your layout, just for showing actual data.

Anyways here the conversion:

cellpadding


td {padding: 0; }

cellspacing


table { border-spacing: 0; }

About Rick

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.
5 comments
  • I agree we shouldn’t be using tables for websites.

    However, the people in charge of deprecation are forgetting that we are still using tables to design emails. And although we can use inline-css, the border spacing doesn’t work the same way as the now deprecated cell-spacing table attribute. This has created display problems in IE, which is what our clients use…

  • Don’t be ridiculous. Tables should not be used for site structure yes I agree HOWEVER, that doesn’t mean that tables don’t have a place in web development. if you want to display data in a table-like format you would want to use…oh wait, I know this, OH YEAH: a table. In other words table based design is bad but tables are not.

  • How does one create a table layout on a web page without using table?

    This statement (above) “In fact you should not be using tables.” is fine, but then what do I do instead?

    I do a lot of development in a lot of languages, platforms, front-end, back-end, enterprise wide, desktop, etc… So my background has a very wide breadth, but it’s depth in specifics (like HTML5) is limited.

    Pleas help (mentor) those who wish to learn without making statements like “don’t do that” without an explanation as to why and what is the alternative.

    Thanks.

    • Hey Craig,

      You’re right. I’ve updated the post to make it more clear.

      A while ago we used to create our site’s layout with tables. No longer. There are other CSS methods (floats, Flexbox or CSS Grid) depending on the browsers you need to support.

      Is still totally valid, and recommended, to use tables if you need to show data. It’s the best semantic use case for accessibility. However the post is still valid, you should not add cellspacing or cellpadding to those data tables.

      Hope this made it more clear.

      Best regards!

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*