html – 垂直中心对齐文本

html – 垂直中心对齐文本,第1张

概述好的,这是现在这个HTML元素的样子: 我希望文本以图像为中心。图像是32×32像素。 这是我的代码: <style>div.interface { line-height: 32px; float: left; margin: 10px; width: 450px; font: 14px/27px 'CalibriRegular', Arial, san 好的,这是现在这个HTML元素的样子:

我希望文本以图像为中心。图像是32×32像素。

这是我的代码:

<style>div.interface {    line-height: 32px;    float: left;    margin: 10px;    wIDth: 450px;    Font: 14px/27px 'CalibriRegular',Arial,sans-serif;    color: #646464; text-shadow: 1px 1px 1px #fff;    padding-right: 10px;}</style><div ><img src="assets/icons/interface.png" />Filled with fun animations and eye-candy!  Complete with Retina graphics.</div>
解决方法 将文字垂直设置为与高度相同的行高,例如:
img{ height: 30px; }#text{ line-height: 30px; }

并设置垂直对齐到中间:

#text{ line-height: 30px; vertical-align:mIDdle; }
总结

以上是内存溢出为你收集整理的html – 垂直中心对齐文本全部内容,希望文章能够帮你解决html – 垂直中心对齐文本所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1111393.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存