账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    html table 宽度问题
    38
    0
    遇到个问题,关于 html 中同时设置 table 元素的 table-layout: fixed; 和 width: 100%;的问题:实际结果如下:如果 .container { width: 600px }, 那么如果不设置 width 属性,则 table 的宽度就是 600px如果设置 table 的 width: 100%; 则 table 的宽度是 col 的宽度之和 1920px;我的疑问是:这个 width: 100% 是怎么计算的?当 width: auto | 100% | 具体像素值; 遇上 table-layout: fixed | auto; 又是怎么计算宽度的?有什么资料可以提供查阅吗?我现在只知道会有这样的效果,但是不知道为什么,找了挺久资料也没找到,有了解的大佬可以跟我指个路我去看看?<style>.container { width: 600px;}table { table-layout: fixed; width: 100%; // 这里切换是否设置宽度}</style><div class="container"> <table class="table"> <col style="width: 30px"> <col style="width: 90px"> <col style="width: 200px"> <col style="width: 200px"> <col style="width: 600px"> <col style="width: 300px"> <col style="width: 500px"> <thead class="thead"> <tr> <th> # </th> <th> 姓名 </th> <th> 年龄 </th> <th> 职业 </th> <th> 住址 </th> <th> 兴趣爱好 </th> <th> 其他 </th> </tr> </thead> <tbody> </tbody> </table></div>
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部