[英]css link appear only while hovering the image
i want to make the f1 link appearing on image only on hovering the image.我想让 f1 链接仅在悬停图像时出现在图像上。 i tried this but this is not working, link is not appearing.
我试过了,但这不起作用,链接没有出现。 can someone explain the problem and type a working code?
有人可以解释这个问题并输入一个工作代码吗?
<div class="caine1">
<img src="1.png" width="400" height="250"></img>
<a href="#" id="f1">Female</a>
</div>
#f1 {
position:absolute;
display: none;
z-index: 200;
}
.caine1 img:hover #f1 {
display: inline-block;
}
You're missing +
.你错过了
+
。
#f1 { position: absolute; display: none; z-index: 200; } /* You missed a + here */.caine1 img:hover + #f1 { display: inline-block; }
<div class="caine1"> <img src="1.png" width="400" height="250" /> <,--Also, images don't have closing tags - they're self closing like <br/>--> <a href="#" id="f1">Female</a> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.