This is not working on my IE:
<table style="padding:5px">...</table>
however it works on Opera.
Is there a workaround?
Complete HTML/CSS Course 2022 Cell padding is the space between cell borders and the content within a cell. To set cell padding in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <table> tag, with the CSS property padding.
HTML tables can adjust the padding inside the cells, and also the space between the cells.
The cellpadding is replaced by the padding property on the <td> element.
The CSS padding properties are used to generate space around an element's content, inside of any defined borders. With CSS, you have full control over the padding. There are properties for setting the padding for each side of an element (top, right, bottom, and left).
The earlier CSS specs (which IE6 follows -- and I use the word "follows" loosely) are not clear about what padding defined on a table should even mean. IE6, naturally, decided to interpret this differently than every other browser, by ignoring the padding. Other browsers decided to render it by adding spacing between the table border and the outermost cells, without affecting the spacing inside cells, or between internal cells. By the time IE7 came out, the specs had cleared up to work like the other browsers, but IE6 still has the problem, where it simply ignores the padding.
The best solution is to avoid putting padding on your table, but instead surrounding it with a div, and putting the padding there.
<div style="padding: 5px;">
<table...>
</table>
</div>
Of course, if what you want is cell spacing or cell padding (as opposed to just padding on the table), then you should use the cellspacing
or cellpadding
attributes (even if you don't want these, you at least need cellspacing="0"
to avoid another separate issue with IE6 table rendering).
Also, the inline styles here are for demo purposes; using css classes is generally considered better practice.
Did you try using <table cellpadding="5">
? IE has problems with some css styling.
Also your syntax is wrong you forgot a semi-colon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With