CSS显示:桌面最小高度不工作

时间:2022-12-15 20:27:38

Does anyone know I can make min-height work with the latest browsers? I am using CSS tables and it seems to ignore min-height.

有没有人知道我可以用最新的浏览器让我保持最小的身高?我正在使用CSS表,它似乎忽略了最小高度。

<div style="background-color: red; display: table; min-height: 100px;">
abc
</div>

Fiddle

小提琴

3 个解决方案

#1


181  

When using tables, height essentially is min-height, as tables always stretch. Just get rid of the "min-" and it will work as you expect.

使用表格时,高度基本上是最小的,因为表格总是拉伸的。只要去掉“min-”,它就会像你期望的那样工作。

#2


2  

Use height: 1px; on the table or any value. Basically you need to give table some height to make it work with min-height. Having only min-height won't work on tables on firefox.

使用高度:1 px;在表格或任何值上。基本上,你需要给桌子一些高度来让它与米高一起工作。只有最小的高度在firefox上是行不通的。

#3


1  

Whenever you are using display:table; or any deeper property like display:table-cell; consider using height instead of min-height. As in tables height = min-height considering the auto-span feature in them.

无论何时使用display:table;或任何更深层的属性,如display:table-cell;考虑使用高度而不是最小的高度。在表中,考虑到其中的自动跨度特性,高度=最小高度。

#1


181  

When using tables, height essentially is min-height, as tables always stretch. Just get rid of the "min-" and it will work as you expect.

使用表格时,高度基本上是最小的,因为表格总是拉伸的。只要去掉“min-”,它就会像你期望的那样工作。

#2


2  

Use height: 1px; on the table or any value. Basically you need to give table some height to make it work with min-height. Having only min-height won't work on tables on firefox.

使用高度:1 px;在表格或任何值上。基本上,你需要给桌子一些高度来让它与米高一起工作。只有最小的高度在firefox上是行不通的。

#3


1  

Whenever you are using display:table; or any deeper property like display:table-cell; consider using height instead of min-height. As in tables height = min-height considering the auto-span feature in them.

无论何时使用display:table;或任何更深层的属性,如display:table-cell;考虑使用高度而不是最小的高度。在表中,考虑到其中的自动跨度特性,高度=最小高度。