Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将文本向上移动?_Html_Css_Xhtml - Fatal编程技术网

Html 将文本向上移动?

Html 将文本向上移动?,html,css,xhtml,Html,Css,Xhtml,我有这个,如果你看右上角的搜索…我需要移动文本搜索大约2倍,使其与图像居中,但我文本对齐垂直对齐或填充没有做我想做的,这里是我的css #Search { background: url("/images/no-letters-search.png") no-repeat scroll 0 0 transparent; border: medium none; font-size: 15px; height: 37px; left: 31px; padding-left: 26px; posit

我有这个,如果你看右上角的搜索…我需要移动文本搜索大约2倍,使其与图像居中,但我文本对齐垂直对齐或填充没有做我想做的,这里是我的css

#Search {
background: url("/images/no-letters-search.png") no-repeat scroll 0 0 transparent;
border: medium none;
font-size: 15px;
height: 37px;
left: 31px;
padding-left: 26px;
position: relative;
top: -3px;
width: 175px;
font-family: Helvetica, sans-serif;
}
这是我的html

<form id="search_form" method="post" action="/mm5/merchant.mvc?">
 <input type="text" name="Search" id="Search" tabindex="0" />
 <input name="Screen" type="hidden" value="SRCH" />
</form>


Erm,试试
行高:18px-可能会这样。

如上所述,尝试将行高设置为输入框的高度,该高度应使单行文本居中。

文本实际上已与输入字段居中。问题是你的输入区域比你放在它后面的实际图像高,所以从视觉上看,它看起来不对位(技术上,它已经居中了)

当前输入字段的高度为37像素,但由于输入字段是带有边框的长方体模型元素(中),因此长方体的高度实际上约为41像素。您需要删除边框,或者只是将输入字段的大小减少到34px或33px

或者您可以正确地将“border:medium none”重写为“border:0”


如果这些都没有意义的话,我建议先研究一下CSS框模型。

mac上的Firefox4是我的浏览器,但我正在研究所有这些