Chrome 和 IE 中 CSS 图像悬停问题
当我在 Chrome 和 IE 中使用 CSS 悬停将鼠标悬停在图像上时,出现显示隐藏图像的问题,但在 Firefox 中工作正常。 这是我的链接:https://www.solarisdutamas.com/fb/Elvieloon/welcome1.php
这是我的编码:
<html>
<head>
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" media="screen" href="css-hover.css" />
</head>
<title>Elvie Loon</title>
<meta content="Professional Makeup Artist and Hair Stylist" name="description">
<style type="text/css">
.over .pic1 {
display:none;
visibility:hidden;
}
.over:hover .pic1 {
display:inline;
visibility:visible;
position:absolute;
top:250px;
left:100px;
z-index:11;
}
</style>
<body style="margin: 0px; width: 520px;">
<img src="landing-page.jpg" usemap ="#fly1map" />
<a class="over">
<map name="fly1map">
<area shape="poly" coords="387,339,433,365,416,376,425,395,371,393,391,369,387,339" href="">
</map>
<img src="pic-1.png" class="pic1">
</a>
</body>
</html>
请帮忙,谢谢。
I have problem of display an hidden image when mouse over to an image by using CSS hover in Chrome and IE, but is working fine in Firefox.
Here is my link: https://www.solarisdutamas.com/fb/Elvieloon/welcome1.php
Here is my coding:
<html>
<head>
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" media="screen" href="css-hover.css" />
</head>
<title>Elvie Loon</title>
<meta content="Professional Makeup Artist and Hair Stylist" name="description">
<style type="text/css">
.over .pic1 {
display:none;
visibility:hidden;
}
.over:hover .pic1 {
display:inline;
visibility:visible;
position:absolute;
top:250px;
left:100px;
z-index:11;
}
</style>
<body style="margin: 0px; width: 520px;">
<img src="landing-page.jpg" usemap ="#fly1map" />
<a class="over">
<map name="fly1map">
<area shape="poly" coords="387,339,433,365,416,376,425,395,371,393,391,369,387,339" href="">
</map>
<img src="pic-1.png" class="pic1">
</a>
</body>
</html>
Please help, thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不用可见性,试试这个...
Ps 语句中的两行都做同样的事情,底部过滤器,只是 IE 的做法。
Instead of visibility try this...
P.s Both lines inside the statement do the same thing, the bottom filter, is just IE's way of doing it.
问题是您无法将鼠标悬停在隐藏元素上(请参阅 为什么 CSS 可见性不起作用?)。
两个想法...
1.您可以使用具有两个图像的技术。除了您的图像之外,还创建一个相同大小的透明图像。然后将鼠标悬停在其上翻转它们。
2. 这种方法需要一些额外的标记,但本质上它会在图像上方放置一个
。当您将鼠标悬停在
上时,它会使用
z-index
移动到图像下方。The problem is that you can't hover over a hidden element (see Why isn't CSS visibility working?).
Two ideas...
1. You could use a technique with two images. In addition to your image, create a transparent image of the same size. Then flip them on the mouse hover.
2. This approach takes some additional markup, but essentially it places a
<div>
above the image. When you hover over the<div>
it is moved below the image using thez-index
.Chrome 和 IE8 存在一个与绝对定位元素上的 :hover 和 z-index 相关的已知错误。
Chrome:问题 83533
There is a known bug with Chrome and IE8 related to :hover and z-index on absolute positioned elements.
Chrome: Issue 83533