在铬的灰色边界出现的臭虫

时间:2013-09-16 10:09:13

标签: html css

我已应用以下html

<input type="image" value="Search" class="button" src="" onclick="this.form.searchword.focus();">

这就是css ......

#header form .button
{
    /*border:solid 1px #999;*/
    background:#664335 url(../images/btn-search.jpg) no-repeat ;
    /*color:#fff;*/
    display: inline-block;
    font-size: 0;
    width: 16px;
    height: 20px;
    vertical-align: middle;
    background-color: transparent !important;
    border: none;

}

我尝试删除宽度和高度并为其设置填充值但是没有成功。当我搜索不同的问题时,我开始知道如果没有应用src属性,那么将出现边框。但在我的情况下,标记我无法编辑,所以有任何方法可以删除该错误。

无论如何,我通过使用jquery将类型图像更改为按钮来解决它。

2 个答案:

答案 0 :(得分:0)

此次搜询已经被问过不止一次,对此最好的解决办法就是使用type="submit"代替type="image",然后根据需要在CSS中设置样式

P.S。 type="image"无法在Chrome中使用,请尝试为您的代码寻找另一种方式,因为该边框是错误图像的占位符,就像在IE中广为人知的红叉十字架,它就在那里,你可以试试添加写有“搜索”的图像,或者在那里添加1x1像素透明图像,但这就是全部。

答案 1 :(得分:0)

应用CSS:

#header form .button {
border: solid 1px #999;
background: #664335 url(../images/btn-search.jpg) no-repeat;
color: #fff;
display: inline-block;
font-size: 0;
width: 16px;
height: 20px;
vertical-align: middle;
background-color: transparent !important;


// delete this
border: none;


}
相关问题