输入类型=“图像”在 Chrome 中显示不需要的边框,在 IE7 中显示损坏的链接

发布于 2024-10-01 00:52:48 字数 1003 浏览 4 评论 0原文

我还没有找到解决方案...

我尝试了一切

border:0;
border:none;
outline:none;

但没有任何运气...有趣的是 IE7 中的损坏链接图标与我的图像重叠。

有什么建议吗? 链接此处

HTML(由 WordPress 生成)

<form id="searchform" method="get" action="http://eezzyweb.com/">
   <div>
  <input id="s" name="s" type="text" value="" size="32" tabindex="1"/>
  <input id="searchsubmit" name="searchsubmit" type="image" value="" tabindex="2"/>
   </div>
</form>

CSS

input#s{
position:relative;
width:245px;
height:28px;
border:0;
vertical-align:bottom;
background:url(images/input-search-bkg.png) 0 0 no-repeat;
}

#searchsubmit {
display:inline-block;
background:url(images/submit-bkg.png) 0 0 no-repeat;
width:30px;
height:30px;
border:0;
vertical-align:bottom;
}

Firefox 和 Opera 可以正常渲染图像按钮,但在 Chrome 和 Safari 中我明白了周围有灰色边框。 IE 7 和 8 在我的图像上添加了一个符号(损坏的图标?)...我很困惑。

I have not found a solution yet...

I tried everything

border:0;
border:none;
outline:none;

without any luck...and the funny thing is the broken link icon in IE7 which overlaps my image.

Any suggestion?
link here

HTML (generated by WordPress)

<form id="searchform" method="get" action="http://eezzyweb.com/">
   <div>
  <input id="s" name="s" type="text" value="" size="32" tabindex="1"/>
  <input id="searchsubmit" name="searchsubmit" type="image" value="" tabindex="2"/>
   </div>
</form>

CSS

input#s{
position:relative;
width:245px;
height:28px;
border:0;
vertical-align:bottom;
background:url(images/input-search-bkg.png) 0 0 no-repeat;
}

#searchsubmit {
display:inline-block;
background:url(images/submit-bkg.png) 0 0 no-repeat;
width:30px;
height:30px;
border:0;
vertical-align:bottom;
}

Firefox and Opera render the image button ok, but in Chrome and Safari I get that grey border around it.
IE 7 and 8 add a symbol (broken icon?) over my image... I am baffled.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

十年不长 2024-10-08 00:52:48

您正在使用该图像作为背景。为什么不将其设置为按钮的 src 属性?

<input src="images/submit-bkg.png" id="searchsubmit" name="searchsubmit" type="image" value="" tabindex="2"/>

当您将 type 设置为 image 时,输入也需要 src 属性。

参考:http://www.w3.org/TR/html401/interact/forms.html#adef-src 和 http://www.w3.org/ TR/html401/interact/forms.html#h-17.4.1

You are using the image as a background. Why not set it as the src property of the button ?

<input src="images/submit-bkg.png" id="searchsubmit" name="searchsubmit" type="image" value="" tabindex="2"/>

When you set the type as image the input expects an src attribute as well..

Reference: http://www.w3.org/TR/html401/interact/forms.html#adef-src and http://www.w3.org/TR/html401/interact/forms.html#h-17.4.1

戏舞 2024-10-08 00:52:48

作为参考,如果您想坚持使用 CSS 为按钮提供图像,出于提供 :hover 或 :active 规则等原因,您可以保持代码不变并为按钮添加不可见的图像,我选择了:

这意味着它是完全透明的图像,大小似乎并不重要,但我选择了 1 px x 1px。

For reference, if you want to stick to using CSS to give the button an image, for reasons such as providing a :hover or an :active rule, you can keep your code as is and add the button an invisible image, i went with:

<input type='image' src='invisible.png'/>

Which means its a completly transparent image, size doesnt seem to matter, but i went with 1 px by 1px.

千笙结 2024-10-08 00:52:48

这对我有用:

input[type="image"]:focus {
    outline: none;
}

This worked for me:

input[type="image"]:focus {
    outline: none;
}
鹿! 2024-10-08 00:52:48

Chrome、IE 和 Safari 会愚蠢地解析代码。

<input type="image" src="bleh.png">
<input type="image" src="bleh.gif">

不同

<input type="image" src="bleh.png"><input type="image" src="bleh.gif">

这些浏览器的解析方式与将所有图像输入放在编码文档中的同一物理行上 。我刚刚通过我的显示器打了一个完整的同样的问题,直到我意识到这一点。

Chrome, IE, and Safari parse the code foolishly.

<input type="image" src="bleh.png">
<input type="image" src="bleh.gif">

is not parsed the same by these browsers as

<input type="image" src="bleh.png"><input type="image" src="bleh.gif">

Put all of your image inputs on the same physical line in the coded document. I just about punched a whole through my monitor with the same problem until I realized this.

小红帽 2024-10-08 00:52:48

这很丑,但它有效......

<input id="saveForm" style="border:0px;" type="image" name="submit" value="Submit" BORDER="0" src="./images/button_submit.png" />

This is ugly but it works...

<input id="saveForm" style="border:0px;" type="image" name="submit" value="Submit" BORDER="0" src="./images/button_submit.png" />
赢得她心 2024-10-08 00:52:48

试试这个

a:active {
 outline: none;
}
a:focus {
 -moz-outline-style: none;
}
a, input {
 outline-color: invert;
 outline-style: none;
 outline-width: medium;
}

Try this

a:active {
 outline: none;
}
a:focus {
 -moz-outline-style: none;
}
a, input {
 outline-color: invert;
 outline-style: none;
 outline-width: medium;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文