0

我已经应用了以下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 将类型图像更改为按钮来解决它。

4

2 回答 2

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;


}
于 2013-09-16T10:19:17.417 回答
0

这个问题已经被问过不止一次了,最好的解决方案就是使用CSStype="submit"而不是type="image"你喜欢的样式

PStype="image"不能如您所愿地在 chrome 中工作,请尝试为您的代码寻找另一种方式,因为该边框是错误图像的占位符,例如 IE 中广为人知的白框红十字,它就在那里,您可以尝试添加具有写在上面的“搜索”或者可能在那里添加 1x1 像素的透明图像,但仅此而已。

于 2013-09-16T10:15:52.290 回答