css - 表 : Containing div only has width of the first columns 内的多列 div

标签 css css-multicolumn-layout

我试图在另一个可能包含多列的 div 周围放置一个“div”。

但是,如您所见here

<table class="datatable">
<tr>
   <td class="leftcolumn">Radiobuttons:</td>
   <td class="rightcolumn">
      <div style="border: 2px solid grey;">
         before
         <div class="morecols">
            <label><input type="radio" name="ctypeid" value="1" /> One</label><br />
            <label><input type="radio" name="ctypeid" value="2" /> Two</label><br />
            <label><input type="radio" name="ctypeid" value="3" /> Three</label><br />
            <label><input type="radio" name="ctypeid" value="4"checked="checked" /> Four</label><br />
            <label><input type="radio" name="ctypeid" value="5" /> Five</label><br />
            <label><input type="radio" name="ctypeid" value="6" /> Six</label><br />
            <label><input type="radio" name="ctypeid" value="7" /> Seven</label><br />
            <label><input type="radio" name="ctypeid" value="8" /> Eight</label><br />
            <label><input type="radio" name="ctypeid" value="9" /> Nine</label>
         </div>after
      </div>
   </td>
</tr>
</table>

蓝色的 div 仅与第一列一样宽。我想包含所有这三个。

我在这里错过了什么?

最佳答案

.morecols { <br>
   height: 65px;
   -webkit-column-count: 3; /* Chrome, Safari, Opera */
   -moz-column-count: 3; /* Firefox */
   border: 1px solid black;
   column-rule: 1px solid grey;
     background-color: #ccccff;
}

关于css - 表 : Containing div only has width of the first columns 内的多列 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36847536/

相关文章:

css div 跨列换行

html - CSS 列布局隐藏空列

html - Safari:具有绝对位置的 CSS 多列悬停错误?

javascript - 如何使用 Scriptaculous 滑动被外部 CSS 隐藏的元素?

jquery - 在容器边界之外启用 bxSlider

jquery - 需要帮助修复另一个带有滚动的 div 中的顶部栏

javascript - Bootstrap 选项卡面板标题和内容等高

html - 希望在 2 行中有 3 列,内容仅为图像

css - 具有多列列属性的 Flexbox,Firefox 中的错误?

javascript - 圆 div 内的文本。根据内容调整 div 大小