Table's 的宽度因显示而冻结:块 [英] Table's width frozen because of display: block

查看:23
本文介绍了Table's 的宽度因显示而冻结:块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个页面,其中包含一个 table 和其中的一些数据.虽然我将表格的宽度设置为其父 div 的 80%,但内部 tbody 和其他孩子的宽度被冻结为 450px.

我还注意到,一旦我删除了属性 display: block,表格的子项就会正确显示(表格的 100% 宽度)

我是否有特殊原因将宽度冻结在 450 像素?我在CSS中到处检查,我没有设置这样的规则.

这是我的表的代码:

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

解决方案

tables 有自己的显示类型:table"(这是唯一可能的),类似 trtd 分别显示table-row"和table-cell"

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"

这篇关于Table&amp;amp;#39;s 的宽度因显示而冻结:块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆