简体   繁体   English

填充禁用提交按钮

[英]Padding disables the submit button

Following is my HTML for submit button : 以下是我的HTML提交按钮:

<div id="header">
     <table>
        <tr>
            <td><h1></h1></td>
            <td><input type="text" name="search" class="search"/>
             <input type="submit" class="search-btn" name="submit" value="Search"/></td>                        
        </tr>
      </table>
</div>

And following is my CSS : 以下是我的CSS:

#header table td .search-btn{width: 60px; margin-left: 5px;                                                          
                             border: 1px solid #D5EA3B;
                             padding: 9px;
                             display: inline-block;
}

The issue is when I am trying to add padding it disabling the submit button (non-clickable) and if I am removing the padding then its enabling it (clickable). 问题是当我尝试添加填充时禁用了提交按钮(不可单击),如果我删除了填充则启用了填充(可单击)。 This is really weird issue. 这真是一个奇怪的问题。 I am not getting whats exactly this. 我不明白这到底是什么。

Any help would be appreciated. 任何帮助,将不胜感激。

Okay. 好的。

So first your CSS isn't quite correct that you pasted, remove the #header table etc.. 因此,首先您粘贴的CSS不太正确,请删除#header表等。

.search-btn{width: 60px; margin-left: 5px;                                                          
                             border: 1px solid #D5EA3B;
                             padding: 9px;
                             display: inline-block;
}

So the padding isn't the issue, the border is the issue making it appear that it isn't clicking. 因此,填充不是问题,边框是使它看起来好像没有单击的问题。 If you visit: http://jsfiddle.net/3w4e5/2/ you see that the button works as expected,however when you re-add the border is appears to be broken. 如果您访问: http : //jsfiddle.net/3w4e5/2/,您会看到该按钮可以正常工作,但是当您重新添加边框时,该边框似乎已损坏。

You will want to create a hover and active version of the button as well: 您还将要创建按钮的悬停和活动版本:

See: http://jsfiddle.net/3w4e5/3/ 请参阅: http//jsfiddle.net/3w4e5/3/

Update: 更新:

See this fiddle for an active & hover CSS versions added in so it shows that the button is hovered and clicked on, your initial CSS make it's so the button doesn't look like it's being clicked but it is. 请参阅此提琴,以了解其中添加了活动和悬浮CSS版本,它表明该按钮已悬浮并单击,您的初始CSS使得按钮看上去不像单击按钮,但实际上是。

http://jsfiddle.net/3w4e5/4/ http://jsfiddle.net/3w4e5/4/

The problem is because, you have added a border: 1px solid #D5EA3B; 问题是因为您添加了border: 1px solid #D5EA3B;

UPDATE : 更新

The problem is that your td that houses the input type="text" and submit button is overlapping or sitting on top of the Submit. 问题是您的td包含输入type =“ text”和Submit按钮,它们重叠或位于Submit的顶部。 You should divide the second td in to two tds and have input type text in one td and submit button in other. 您应该将第二个td分成两个td,在一个td中输入文本,在另一个td中提交按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM