我们如何使用display:table-cell? [英] How do we use display:table-cell?
问题描述
我有一个div与float:right(没有位置属性声明)。这个div有一些文本内容,有时可能被包装。我想让文本总是垂直居中。声明显示:table-cell和vertical-align:这个div的中间不工作。有人可以指出我对table-cell的正确方向吗?
I have a div with float:right (no position property declared). This div has some text content which may be wrapped sometimes. I want the text to always be vertically centered. Declaring display:table-cell and vertical-align:middle for this div does not work at all. Can somebody point me in the right direction about table-cell?
我使用FF。这将在IE中工作?
I am using FF. Will this work in IE?
推荐答案
如果你声明 display:table-cell
那么你必须将它嵌套在 display:table-row
和 display:table
就像一张真实的桌子。
If you declare display:table-cell
then you have to nest it within elements with display:table-row
and display:table
. Just like a real table.
查看表上的怪癖模式,以查看兼容的浏览器是如何。
Check out Quirks Mode on Tables to see how compatible browsers are.
这篇关于我们如何使用display:table-cell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!