表格的宽度因display:block而冻结 [英] Table's width frozen because of display: block
问题描述
我创建了一个包含表
和其中的一些数据的页面。虽然我将table的宽度设置为它的父div的80%,但内部的 tbody
和其他孩子的宽度被冻结为450px。
我还注意到,一旦我删除了属性 display:block
,表格的子项就被正确显示了(表格的100%宽度)
我有宽度冻结在450px的特殊原因吗?我检查了CSS中的任何地方,并且没有设置这样的规则。
以下是我的表格的代码:
< div id =maincol>
< tbody>
< tr>
...
显示类型: table (并且它是唯一可能的),同样 tr 和 td 分别显示 table-row 和表格单元格
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>
...
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"
这篇关于表格的宽度因display:block而冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!