IE8 中的 CSS 精灵按钮不显示/工作?
我在使用 ie8 和简单的表单提交按钮时遇到问题。我使用图像作为带有一些 CSS 的按钮,因此它具有很好的悬停效果。但它在 IE8 中不起作用/显示。
btnSubmit.png
具有默认状态和悬停状态。
这是我的代码
<input name="form_submit" id="form_submit"
class="btns btnFormsubmit" type="submit" />
和 CSS
.btns {
background-color:transparent;
background-position:left bottom;
background-repeat:no-repeat;
border:0 none;
display:block;
height:31px;
text-indent:-3999em;
}
.btns:hover {
background-position:left top;
cursor:pointer;
}
.btnFormsubmit {
background-image:url(imgs/btnSubimt.png);
height: 31px;
width:267px !important;
}
,我还尝试添加 href="#"
<input href="#" name="form_submit" id="form_submit"
class="btns btnFormsubmit" type="submit" />
I am having an issue with ie8 and a simple form submit button. I use an image as a button with a bit of CSS so it has a nice hover effect. But it doesn't work/show up in IE8.
btnSubmit.png
has the default and hover state.
this is my code
<input name="form_submit" id="form_submit"
class="btns btnFormsubmit" type="submit" />
and CSS
.btns {
background-color:transparent;
background-position:left bottom;
background-repeat:no-repeat;
border:0 none;
display:block;
height:31px;
text-indent:-3999em;
}
.btns:hover {
background-position:left top;
cursor:pointer;
}
.btnFormsubmit {
background-image:url(imgs/btnSubimt.png);
height: 31px;
width:267px !important;
}
I also tried to add href="#"
<input href="#" name="form_submit" id="form_submit"
class="btns btnFormsubmit" type="submit" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
IE8 不支持 quirks 模式下的 input:hover css 选择器。尝试添加一个 doctype 声明(例如
),应该没问题。
IE8 does not support input:hover css selector in quirks mode. Try adding a doctype declaration (like for instance
<!DOCTYPE html>
) and it should be OK.输入很难在不同的浏览器中保持一致的样式。如果您无法让它工作(如果文档类型不是之前建议的问题),我建议使用
。
Inputs are hard to style consistently across different browsers. I would recommend using a
<button type="submit"></button>
if you can't get it to work (if the doctype is not the issue as suggested before).