Table's width frozen because of display: block

落花浮王杯 提交于 2019-12-20 03:57:06

问题


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>
                 ...

回答1:


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"



来源:https://stackoverflow.com/questions/7659087/tables-width-frozen-because-of-display-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!