将文本居中在div中

时间:2013-02-07 19:05:47

标签: html css html5 css3

如何将div中的加号+居中。它似乎仍然是距离底部8个像素和5个像素。我无法弄清楚我做错了什么:

        <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> 

1 个答案:

答案 0 :(得分:0)

您可以在+ div上添加line-height: (value)px,以解决上/下对齐问题,并text-align: center;解决左/右位置问题。

相关问题