views:

99

answers:

1

Hello,

I am using a table nested in a table which happens to have the border-collapse:collapse; property. The problem is with the padding property of the nested table, which Opera seems to ignore.

To reduce it to the simplest possible, with the following HTML code...:

<table style="border-collapse:collapse;">
    <tr>
        <td>
            <table style="padding:3em;">
                <tr><td>ABCDE</td></tr>
            </table>
        </td>
    </tr>
</table>

...the padding property is ignored by Opera, whereas Firefox, Chrome and Safari take it into account in the rendering.

My question is: which one is right? Should I leave it this way and ignore Opera users, or search another way to set my padding because Opera is right on the syntax?

Thank you very much for your help!

A: 

In your case I would simply put the padding in the containing <TD>. If you want to keep it on the table and ignore Opera users, you are not alienating a huge portion of the Web users, though some will no doubt be irritated.

Robusto
Thank you for your answer.The thing is, I cannot change the code of the containing: I am trying to code the nested table, so that it should be displayed correctly when included in a table with the "border-collapse:collapse;" property.I know there are not so much Opera users, but this Opera-only incorrect display troubled me, because I thought Opera was the most standard-compliant browser: therefore I am wondering if it is not a coding error more than an incorrect display by Opera...My question remains: which browser is right? what *should* be displayed with this code?
Socce
Personally I never put padding on a table element. You might try substituting margin for padding. The point is, CSS specs are open to interpretation, and different browsers do different things. It's not that Opera is wrong; the others are just different.
Robusto
If I understand you correctly, there is no defined "correct" rendering of this HTML code, and Opera may have its reasons to believe that the "border-collapse:collapse;" property should invalidate the padding of a nested table (as well as it may be a bug). Therefore I should use a different and less ambiguous CSS description if I want to ensure that the rendering is the same through the different browsers. Well, if I got that right, thank you for your explanations!
Socce
Note: I validated this answer as the accepted answer, but it is Robusto's comment (replying mine), more that his initial answer, that answered my question.
Socce