In the parent div, the position:relative;
and overflow:hidden;
properties will be applied. The overlay will have position:absolute;
with top:50%;
(covering only the bottom half of the parent).
To achieve the desired effect :
Method One : Hide the .overlay
with display:none;
and display it using .con:hover .overlay
with display:block;
Method Two: Initially place .overlay
with top:100%; transition:top 0.5s;
and on hover, change it to top:50%;
. The transition
property provides a slow animation effect.
Refer to the code snippet below for a demonstration using the second method. Font-awesome icons are used for visual elements.
.con{
width:150px;
height:150px;
border-radius:75px;
background-image:url("http://www.chinabuddhismencyclopedia.com/en/images/thumb/b/b8/Nature.jpg/240px-Nature.jpg");
background-size:cover;
overflow:hidden;
position:relative;
}
.overlay{
position:absolute;
top:100%;
left:0;
padding-top:10px;
text-align:center;
width:100%;
height:100%;
background-color:rgba(255,255,255,0.5);
transition:top 0.5s;
}
.con:hover .overlay{
top:50%;
}
.overlay a{
margin:5px;
font-size:1.6em;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="con">
<div class="overlay">
<a><i class="fa fa-briefcase"></i></a>
<a><i class="fa fa-list"></i></a>
</div>
</div>