Jerec TheSith
Jerec TheSith

Reputation: 1942

Table's width frozen because of display: block

I created a page containing a table and some data in it. Although I set table's width to 80% of it's parent div, the inner tbody and other children's width is frozen to 450px.

I also noticed that once I removed the property display: block, the table's children were correctly displayed (100% width of the table)

I there a particular reason for width to be frozen at 450px ? I checked everywhere in my CSS, and I did not set such a rule.

Here is the code of my table :

<div id="maincol">
<table width="80%" border="0" cellpadding="1" cellspacing="0" id="dates" class="summary" name="dates" style="display:block">
    <tbody>
        <tr>
                 ...

Upvotes: 1

Views: 837

Answers (1)

daveoncode
daveoncode

Reputation: 19578

tables have their own display type: "table" (and it's the only one possible), similarly tr and td have respectively display "table-row" and "table-cell"

Upvotes: 4

Related Questions