lundi 20 avril 2015

Why this table go out of the width of its container? [duplicate]

This question already has an answer here:

I am not so into HTML and CSS and I have the following problem

Into my code I have something like this:

<div style="width: 28.75em;">
    <table id="tablistOnHheader" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin: 0 !important;">
        <thead>
            <tr>
                ..........................................................
                ..........................................................
                ..........................................................
            </tr>
        </thead>

        <tbody>
            ...........................................................
            ...........................................................
            ...........................................................
        </tbody>
    </table>
</div>

So I have that the external div have the width spcified using CSS by width: 28.75em; (it is in em) and that the internal table have the width specified by the attribute width="100%"

The problem is that the internal table go out of the 28.75em specified as width of its container. I thought that setting the table width using width="100%" means that it use the 100% of its container but maybe I am missing something.

Why I obtain this behavior? What am I missing? How can I fix this issue?

Tnx

Aucun commentaire:

Enregistrer un commentaire