大图像上的小图像

Small image on top of larger image

本文关键字:图像      更新时间:2024-01-27

我正在尝试将灰色小框放在页面上黑框前面的左上角。图像顶部的图像。我希望灰色的盒子在黑色的盒子上面是可见的。我将顶部和左侧设置为零,并尝试z索引将灰色图像移动到黑色正方形上方,但没有。它需要兼容IE9:

https://jsfiddle.net/Lance_Bitner/zrjttnu1/

.nav-toggle {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-decoration: none;
text-indent: -999px;
position: relative;
overflow: hidden;
width: 70px;
height: 55px;
float: left;
display: block;
margin: 0 -2em 1em 0;

 }
.nav-toggle:before {
color: #444; /* Edit this to change the icon color */
font-family: "responsivenav";
font-style: normal;
font-weight: normal;
font-variant: normal;
font-size: 28px;
text-transform: none;
position: absolute;
content: url(img/menu2.gif);
text-indent: 0;
text-align: center;
line-height: 65px;
speak: none;
width: 100%;
top: 0;
left: 0;
}
.nav-toggle.active:before {
font-size: 24px;
content: url(img/menu3.gif);
}

您可以将导航切换框定位为绝对并设置为顶部:0;

.nav-toggle {
    ...
    position: absolute;
    top: 0;
}

https://jsfiddle.net/Lpyumsck/1/