<div class="frame">
<h3>Single Div Coffee cup</h3>
<div class="center">
<div class="cup"></div>
</div>
</div>
// delete the following line if no text is used
// edit the line if you wanna use other fonts
@import url(https://fonts.googleapis.com/css?family=Open+Sans:700,300);
h3{
text-align:center;
color:#fff;
}
// use only the available space inside the 400x400 frame
.frame {
position: absolute;
top: 50%;
left: 50%;
width: 400px;
height: 400px;
margin-top: -200px;
margin-left: -200px;
border-radius: 2px;
box-shadow: 4px 8px 16px 0 rgba(0, 0, 0, 0.1);
overflow: hidden;
background: #000;
color: #333;
font-family: "Open Sans", Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.cup {
background: #ddd;
width: 200px;
height: 200px;
top: 30%;
border-radius: 100% / 50% 40% 80% 100%;
&:before {
content: "]";
color: #fff;
position: absolute;
font-size: 120px;
right: -33px;
top: 10px;
font-weight: bold;
}
&:after {
width: 150px;
height: 30px;
content: "";
background: #4b371b;
position: Absolute;
border-radius: 100%;
border:3px solid rgba(255,255,255,0.3);
top: 20px;
transform: skew(0deg);
left: 0;
right: 0;
margin: 0 auto;
box-shadow: 2px 2px 10px 2px #4b371b;
animation: coffee-sip 2s ease-in-out alternate infinite;
}
}
View Compiled
// jQuery v3.3.1 is supported
This Pen doesn't use any external CSS resources.