表格布局固定不工作 [英] table-layout fixed not working
本文介绍了表格布局固定不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用以下代码CSS表应该隐藏超过表高度(200px)的内容。不幸的是,这不工作,桌子垂直扩展。任何人都知道为什么?
with the following code the CSS table was supposed to hide the content that exceeds the table height (200px). Unfortually this doesn´t work and the table is vertically expanded. Anyone knows why ?
<div style='display:table; border:1px solid blue;
width:200px; table-layout:fixed; height: 200px'>
<div style='display:table-row'>
<div style='display:table-cell; overflow:hidden'>
contents<br/>contents<br/>contents<br/>contents<br/>contents<br/>
contents<br/>contents<br/>contents<br/>contents<br/>contents<br/>
contents<br/>contents<br/>contents<br/>
</div>
</div>
</div>
<div style='display:inline-block;width:20px;height:200px;
border:1px solid red; position:absolute;top:8px;left:220px'>
</div>
谢谢
推荐答案
从我看到的,你需要添加 class
或 ID
到 divs
。此外,如果你真的想创建一个表,通常没有div堆没有类或ids。以下是有关如何在w3schools制作表格的参考: http://www.w3schools.com/html /html_tables.asp
From what I see, you need to add a class
or ID
to the divs
. Also, if you really want to create a table, do it normally without heaps of divs without classes or ids. Here is a reference on how to make tables at w3schools: http://www.w3schools.com/html/html_tables.asp
这篇关于表格布局固定不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文