htmlcsshtml-tablecellpaddingcellspacing

Why are cellspacing and cellpadding not CSS styles


I don't know why this bothers me so much, but when I create websites, I always try to do all my styling with CSS. However one thing I always have to remember to do when I'm working with tables is add cellspacing="0" and cellpadding="0"

Why is there not a CSS property to override these antiquated HTML 4 attributes?


Solution

  • Cellspacing :

    table { border-collapse: collapse; }
    

    As for cellpadding, you can do

    table tr td, table tr th { padding: 0; }