可滚动身体和colgroup的表不起作用 [英] table with scrollable body and colgroup does not work

查看:198
本文介绍了可滚动身体和colgroup的表不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过colgroup定义cols的宽度。另外,tbody应该是可滚动的。但是不行。我有没有js的解决方案?

I want to define the width of the cols via colgroup. In addition the tbody shall be scrollable. But is does not work. I s there a solution without js?

js小提琴

HTML

     <colgroup>
      <col span="1" style="width: 15%;">
      <col span="1" style="width: 40%;">
      <col span="1" style="width: 20%;">
      <col span="1" style="width: 25%;">
    </colgroup>


推荐答案

您需要设置显示:inline-block; < col>

col{
  display: inline-block;
  height:20px;
  background: #000;
}

在此处查看演示

这篇关于可滚动身体和colgroup的表不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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