对齐搜索表单按钮

时间:2013-11-21 13:14:09

标签: html css forms button alignment

我知道很多其他人都有这个问题,我已经梳理了这个网站和其他人,并尝试了很多帮助其他人的修复工具,我无法为我工作。这是我的问题:

我需要向下移动一个约2px的搜索按钮,使其与输入框居中。但是,每次我尝试调整填充或添加边距或任何内容时,输入框和按钮都会受到影响。

我还尝试将一个类添加到表单的按钮部分,但即使这样也会影响输入框。

HTML:

<div id="searchCon">    
<form role="search" method="get" id="searchform" class="searchform" action="http://somesite.com/">
<div>
    <label class="screen-reader-text" for="s">Search Our Site:</label>
    <input type="text" value="" name="s" id="s">
    <input type="image" value="Search" src="button.png" id="searchsubmit" style="opacity: 1;">
</div>
</form>
</div>

CSS:

 #searchCon{
    float: right;
    display: inline-block;
    height:37px;
    padding: 0px 10px 10px 280px;
    color:#2a2a2a;
}

任何帮助都会非常感激!!!

1 个答案:

答案 0 :(得分:0)

您也可以使用按钮样式执行此操作:

<input type="image" value="Search" src="button.png" id="searchsubmit" style="opacity: 1; float: right; margin-top: 1px;">
相关问题