在不知道高度的情况下居中div [英] Center a div without knowing the height
本文介绍了在不知道高度的情况下居中div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个div,我知道的高度。里面有一个div,我不知道的高度,因为它有可以改变的文本。我在Stackoverflow中找到了一些解决方案,但它不适用于我或我不正确使用它。在这个特定的情况下,任何人都可以中心div小吗? http://jsfiddle.net/JTTEM/2/
I have a div that I know the height. Inside there is a div that I don't know the height because it has text that can change. I found some solutions in Stackoverflow but it doesn't work for me or I am not using it correctly. Can anyone center the div small in this specific case? http://jsfiddle.net/JTTEM/2/
推荐答案
没有javascript,浮动像 display:table
:
Without javascript, floating the big, or tricks like display:table
:
这篇关于在不知道高度的情况下居中div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文