在div中居中文本 [英] Centering text in a div
本文介绍了在div中居中文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在div中加入+号。它仍然似乎它的8像素从和5从底部。我不知道我做错了什么:
How do I center the plus sign + in the div. It still seems that its 8 pixels from and 5 from the bottom. I can't figure out as to what I am doing wrong:
<div style="background: #ffffff; width: 180px; height: 20px; border: 1px solid #808080;">
<div style="float: left;"><input style="padding-left: 4px; padding-right: 3px; height: 15px; width: 160px; border: none;" type="text"></div>
<div style="display:table-cell; vertical-align:middle;font-size: 11pt; color: #779297;">+</div>
</div>
推荐答案
height;(value)px 在+ div,解决上/下对齐,和 text-align:center;
/左位置。
You can add line-height: (value)px
on the + div, to solve the top/bottom align, and text-align: center;
to solve the right/left position.
这篇关于在div中居中文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文