This method works effectively without the need for JavaScript or animations, relying solely on transitions.
I achieved this by utilizing both an inner element and a pseudo-element within the inner element. While it presents an interesting concept, adjusting it can be challenging due to many hardcoded values based on the height of the element. Utilizing a preprocessor like SCSS would greatly simplify the process of manipulation.
Below is the code, which may benefit from some tidying up:
/* HTML */
<div class='outer'>
Contacts
<div class='innerCircle'></div>
</div>
/* CSS */
.outer {
width:150px; height:50px;
border-radius:10px;
background:blue;
text-align:center;
color:white;
line-height:50px;
position:relative;
}
.innerCircle {
position:absolute;
top:50%; left:50%;
background:white;
color:black;
overflow:hidden;
border-radius:50%;
transition:all .5s;
height:0; width:0;
padding-left:-10px;
}
.innerCircle:before {
content:'Contacts';
position:absolute;
margin-left:-2px;
transition:all .5s;
transform:translateX(-25px);
top:-25px;
}
.outer:hover .innerCircle {
margin-left:-25px;
top:0;
height:50px; width:50px;
}
.outer:hover .innerCircle:before {
top:0px;
}
Check out the Demo here