Table's 的宽度因显示而冻结:块

编程入门 行业动态 更新时间:2024-10-24 12:22:35
本文介绍了Table's 的宽度因显示而冻结:块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我创建了一个页面,其中包含一个 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 12:27:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1135409.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:宽度   Table   amp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!