The code below is for a responsive flex circle example but I don't understand what the .circle:before
is doing exactly and how it helped here? I thought the ::before
class would apply something in front of an element.
.circle-wrap {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.circle {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
background: #bada55;
border-radius: 50%;
margin: 5px;
}
.circle:before {
content: "";
display: block;
padding-top: 100%; /* ratio of 1:1*/
}
<div class="circle-wrap">
<div class="circle"></div>
</div>