在固定高度的块中垂直对齐图像 [英] Vertical-align image in a fixed-height block

查看:108
本文介绍了在固定高度的块中垂直对齐图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试让BOTTOM在固定高度的区块中对齐图片:

I'm trying to BOTTOM align an image in a fixed-height block:

div { float: left; width: 100px; height: 100px; line-height: 100px; }
div img { vertical-align: middle; }

...适用于现代浏览器,IE除外! IE很难,但我真的需要一个修复,如果可能。

...works in modern browsers, except IE! IE sucks no wonder, but I really need a fix, if possible.

编辑添加:不能使用表或背景图片。

Edited to add: Can't use tables or background image.

非常感谢

推荐答案

为什么你不能只是位置:

Why can't you just position:relative the division, position:absolute and mess with bottom/left properties?

或者将它的位置切换到inline-block并玩耍。

Or toggle it's position to inline-block and play around.

这篇关于在固定高度的块中垂直对齐图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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