IE7 翻转不工作
我有一些代码在 IE8、FF 和 IE8 中运行良好。 PC 上有 Safari,但 IE7 上没有。这个想法是有一个大按钮,标签中带有背景图像,文本和内容包含在标签中。前景图像。当用户将鼠标滑过按钮时,背景图像将替换为不同的图像:
CSS:
ul { list-style-type:none; }
ul li { display:inline; }
ul li.link a {
position:relative;
float:left;
margin:0 10px 10px 0;
background:url(templatebtn.jpg) no-repeat;
width:294px;
height:250px;
display:block;
padding:6px 0 0 6px;
}
ul li.link a:hover {
position:relative;
float:left;
margin:0 10px 10px 0;
background:url(templatebtnover.jpg) no-repeat;
width:294px;
height:250px;
display:block;
padding:6px 0 0 6px;
cursor:pointer;
}
HTML:
<ul>
<li class="link">
<a id="button1" class="btn">
<div class="btntitle"><p><strong>A title</strong></p></div>
<div class="btnpic"><img src="pic.jpg" /></div>
</a>
</li>
...
</ul>
在 IE7 中,悬停时不会替换图像,并且光标不会更改为指针。即使我从 css a:hover 中删除了大部分内容,并且只有 a:hover {cursor:pointer;它仍然不起作用(即光标没有改变)。我已经用谷歌搜索了这个年龄&一定缺少一些明显的东西......还有想法?
谢谢, G
I have some code which is working fine in IE8, FF & Safari on a PC, but not in IE7. The idea is to have a large button, with a background image in the tag, and text & a foreground image. When the user rolls over the button, the background image is replaced with a different one:
CSS:
ul { list-style-type:none; }
ul li { display:inline; }
ul li.link a {
position:relative;
float:left;
margin:0 10px 10px 0;
background:url(templatebtn.jpg) no-repeat;
width:294px;
height:250px;
display:block;
padding:6px 0 0 6px;
}
ul li.link a:hover {
position:relative;
float:left;
margin:0 10px 10px 0;
background:url(templatebtnover.jpg) no-repeat;
width:294px;
height:250px;
display:block;
padding:6px 0 0 6px;
cursor:pointer;
}
HTML:
<ul>
<li class="link">
<a id="button1" class="btn">
<div class="btntitle"><p><strong>A title</strong></p></div>
<div class="btnpic"><img src="pic.jpg" /></div>
</a>
</li>
...
</ul>
In IE7, the image is not replaced on hover, and the cursor doesn't change to a pointer. Even if I remove most of the gunk from the css a:hover, and just have a:hover { cursor:pointer; } it still doesn't work (i.e. the cursor doesn't change). I've googled this for an age & must be missing something obvious... And ideas?
Thanks,
G
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
div
更改为span
。 XHTML 和 HTML <5 不允许div
位于a
内。编辑:哦,当你这样做时,删除
p
,因为span
内的p
是不允许的。 :)编辑 2:向
a
标记添加href
属性。Change
div
tospan
. XHTML and HTML <5 do not allowdiv
insidea
.Edit: Oh and while you are at it, remove the
p
, becausep
insidespan
is not allowed. :)Edit 2: Add a
href
attribute to thea
tag.