html - 鼠标悬停在 HTML 上时获取前面的图像

标签 html css

我在 div 中有很多图像按钮,我希望当我将鼠标悬停在图像中时,它会更改 scr 并显示相同的图像,但用边框突出显示。 像这里一样显示之前/之后:

enter image description here

它工作正常,但是当我将所有其他图像放在一起时,它显示如下:

enter image description here

我想我需要在鼠标悬停在前面时设置图像;知道吗?

更新: 代码:

 <div id="mymap" width="720" style="width: 920px; height: 1227px; position: relative; left: 250px; transform: scale(.5,.5); -ms-transform: scale(.5,.5); -webkit-transform: scale(.5,.5); -o-transform: scale(.5,.5); -moz-transform: scale(.5,.5);">
        <img id="Burimi" style="position: absolute; left: 10px" src="Images/Reagion/Burimi-B.png" onmouseover="this.src='Images/reagion/Burimi-A.png'" onmouseout="this.src='Images/reagion/Burimi-B.png'" />
        <img id="N Batinah" style="position: absolute; left: 98px; top: 1px;" src="Images/Reagion/N Batinah-B.png" onmouseover="this.src='Images/reagion/N Batinah-A.png'" onmouseout="this.src='Images/reagion/N Batinah-B.png'" /></dive>

最佳答案

使用简单的 CSS,您应该能够更改 z-index 属性。假设元素定位在 absoluterelative 中,只需使用

#mymap img:hover { z-index: 9999; }

关于html - 鼠标悬停在 HTML 上时获取前面的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15140278/

相关文章:

html - 如何在CSS中的元素上做透明度渐变?

html - 为什么宽度为 : 100% is not assuming the full window width size?

javascript - onClick 后清除下拉值吗?

html - CSS flex : How to get equal heights in flex rows

html - CSS 截断了我的图像

javascript - 如何判断我的网站是否导致浏览器崩溃和烧毁?

html - 实现抽屉导航 Bootstrap

html - 全宽水平导航栏,悬停时全宽水平下拉菜单

javascript - 通过单击链接更改特定 Div 背景颜色

html - 我的 CSS 没有改变,为什么?