-1

I'm setting cell padding on a HTML table using : cellpadding: 10

A padding style is being inherited which causes the cellpadding to not be set :

enter image description here

So if I deselect the padding checkbox above (in Chrome) the cellpadding is applied correctly. How can I prevent the "padding: 0" style being set on my table. I've tried using !important on the cellspacing but this does not seem to have any effect.

blue-sky
  • 51,962
  • 152
  • 427
  • 752

2 Answers2

1

I'd avoid using the cellpadding attribute and use CSS to control your presentation.

It looks as though you're using a css reset to zero out browser default values so you simple need to re-define them where needed:

th, td {
  padding: 10px;
}
David Randall
  • 770
  • 3
  • 9
0

Try creating more specific selectors. Something like

#myBody .myDiv table th, #myBody .myDiv table th {
    padding: 10px;
}
Drkawashima
  • 8,837
  • 5
  • 41
  • 52