栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

为什么溢出:隐藏在a中不起作用?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

为什么溢出:隐藏在a中不起作用?

需要设置

table-layout:fixed
表元件上的合适的宽度,以及
overflow:hidden
white-space:nowrap
在桌子上的细胞。


例子

定宽列

表格的宽度必须与固定宽度的单元格相同(或更小)。

使用一个固定宽度的列:

* {  box-sizing: border-box;}table {  table-layout: fixed;  border-collapse: collapse;  width: 100%;  max-width: 100px;}td {  background: #F00;  padding: 20px;  overflow: hidden;  white-space: nowrap;  width: 100px;  border: solid 1px #000;}<table>  <tbody>    <tr>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>    </tr>    <tr>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>    </tr>  </tbody></table>

使用多个固定宽度的列:

* {  box-sizing: border-box;}table {  table-layout: fixed;  border-collapse: collapse;  width: 100%;  max-width: 200px;}td {  background: #F00;  padding: 20px;  overflow: hidden;  white-space: nowrap;  width: 100px;  border: solid 1px #000;}<table>  <tbody>    <tr>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>    </tr>    <tr>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>    </tr>  </tbody></table>

固定和流体宽度色谱柱

必须设置 表格的宽度,但是任何多余的宽度都可以由流体单元简单地获取。

对于多列,固定宽度和流体宽度:

* {  box-sizing: border-box;}table {  table-layout: fixed;  border-collapse: collapse;  width: 100%;}td {  background: #F00;  padding: 20px;  border: solid 1px #000;}tr td:first-child {  overflow: hidden;  white-space: nowrap;  width: 100px;}<table>  <tbody>    <tr>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>    </tr>    <tr>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>      <td>        This_is_a_terrible_example_of_thinking_outside_the_box.      </td>    </tr>  </tbody></table>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/614975.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号