使用CSS垂直排列嵌套的DIV [英] Vertically align nested DIVs using CSS

查看:405
本文介绍了使用CSS垂直排列嵌套的DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看

http:// jsfiddle .net / user0815 / ZU9bT /



我希望包含图像的两个DIV应该在外部DIV中垂直对齐。 b
$ b

我尝试使用常见的技巧:

  display:table-cell 
vertical -align:center

但是没有爱。

任何想法?

解决方案

它应该是 vertical-align:middle and not vertical-align:center



检查演示 http://jsfiddle.net/ZU9bT/2/






更新后的演示替换为 display:inline-block of float:left http://jsfiddle.net/ ZU9bT / 3 /

Look at at

http://jsfiddle.net/user0815/ZU9bT/

I want that the two DIV containing an image each should be vertically aligned within the outer DIV.

I tried the common tricks using

display: table-cell
vertical-align: center

but no love.

Any idea?

解决方案

It should be vertical-align: middle and not vertical-align: center.

Check this demo: http://jsfiddle.net/ZU9bT/2/


Updated demo with display: inline-block instead of float: left: http://jsfiddle.net/ZU9bT/3/

这篇关于使用CSS垂直排列嵌套的DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆