Home  >  Article  >  Web Front-end  >  input控件 求大神赐教!_html/css_WEB-ITnose

input控件 求大神赐教!_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:58:051092browse

  怎样才能让input控件里面的文字垂直方向居中 试过好多属性都不行 是在不能居中贴着下边框也可以,麻烦大神想想办法吧!! 谢谢


回复讨论(解决方案)

1:贴着下边框
调一下font-size:14px;  或者line-height:20px等等

2:文字垂直方向居中试试,想要实现有可能需要多个属性在一起才可以
style="text-align:center; vertical-align:middle;line-height:20px;height:20px;"
3:参考

input::-moz-focus-inner{ border: 0;padding: 0;}/*针对Firefox*/
.comment_btn{
height:26px;
line-height:22px;/*针对IE*/
width:68px;
}


 

<div class="search" style="font-size: 12px;text-align: center;height:30px"><input type="text" name="q" class="searcht" style="background-image: url('images/4.jpg');font-size: 18px;vertical-align:middle;"/><input type="submit" class="searchb" style='vertical-align:middle;' value="搜索"/><i style='vertical-align:middle;display:inline-block;height:100%;width:0;overflow:hidden'></i></div>

input设置padding

给input设置 css  height  line-height 两个保持一致就能垂直居中

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn