如何保持文本在任何条件垂直对齐? [英] How to keep the text vertically aligned in any condition?
本文介绍了如何保持文本在任何条件垂直对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如在下面的图像中,我想保持文本总是垂直对齐在所有条件。即使文本是一行,两行或三行。
表示文本应该始终垂直居中。我不想添加额外的 span
< div&
< img src = abc.jpg> Hello Stackoverflow。谢谢帮助我
< / div>
我想使用此html实现。
编辑
我不想给任何元素赋予宽度和高度。
解决方案Chris Coyier在这篇文章中写了一本出色的教程: http://css-tricks.com / vertical-center-multi-lined-text /
我已经自己使用,而且效果很好。
For example in the below image I want keep the text always vertically aligned in all condition. even if text is in one, two or three lines.
means the text should be vertically centered always. I don't want to add extra
span
<div> <img src=abc.jpg"> Hello Stackoverflow. Thank you for help me </div>
I want to achieve with this html.
Edit
And I don't want to give fix width and height to any element
解决方案Chris Coyier wrote an excellent tutorial on just this: http://css-tricks.com/vertically-center-multi-lined-text/
I've used it myself, and it works perfectly.
这篇关于如何保持文本在任何条件垂直对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文