我怎么能对齐中间的高度 [英] how can I align to middle by height

查看:119
本文介绍了我怎么能对齐中间的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建图像框(带有图像)。

当文本在框的顶部时很难看。



我如何将文本对齐到中间?

我试图使用 vertical-align ,但似乎不起作用




I want to create image box(with image).
It's ugly when text is in the top of box.

How can I align text to middle?
I tried to use vertical-align, but it seems, that it don't works

Demo of my code

EDIT:
Your solution works fine with short messages.
But if they will be multi-lined, it is ugly again.
Is it possible to not increase size of line If we don't need it?

解决方案

What usually works fine is line-height:

line-height: 32px;

http://jsfiddle.net/DhHnZ/2/

这篇关于我怎么能对齐中间的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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