【发布时间】:2015-12-31 05:35:43
【问题描述】:
我正在尝试为其中包含用户个人资料图片的用户创建一个 DP 框,在图像悬停时会出现一个编辑个人资料图片链接,但它不起作用。当我将鼠标悬停在图像上时,它会闪烁并且链接显示不正确。
这里是codepan链接click here
@import url(https://fonts.googleapis.com/css?family=Roboto);
body {
font-family: 'Roboto', sans-serif;
background-color: #eee;
}
.dp {
width: 128px;
height: 128px;
margin: 0 auto;
border-radius: 50%;
border: 4px solid #fff;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.52);
overflow: hidden;
position: relative;
}
.edit-dp a {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
line-height: 130px;
background-color: rgba(0, 0, 0, .9);
text-align: center;
transition: all .2s ease-in-out;
color: #fff;
font-size: 15px;
text-decoration: none;
display: none;
}
.dp img:hover ~ .edit-dp a {
display: block;
}
<div class="dp">
<img src="http://rs618.pbsrc.com/albums/tt265/davejarrett/Avatars/check-in-minion_zps7ee060ac.jpg~c200" alt="" width="128">
<div class="edit-dp">
<a href="#">Edit Image</a>
</div>
</div>
【问题讨论】:
-
你在寻找类似JSFiddle的东西吗?
标签: html css hover css-transitions