If you use percentages to size child elements, simply set a size to the parent element, such as .checkmark
, and they will grow accordingly.
By implementing it this way, the circle will adjust properly when transformations are applied to the inner pseudo-element.
.checkmark {
position: relative;
display: inline-block;
width: 75px;
height: 75px;
}
.checkmark2 {
position: relative;
display: inline-block;
width: 100px;
height: 100px;
}
.checkmark_circle {
position: absolute;
width: inherit;
height: inherit;
background-color: green;
border-radius: 50%;
left: 0;
top: 0;
}
.checkmark_circle::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 40%;
height: 25%;
border-left: 8px solid white;
border-bottom: 8px solid white;
-webkit-transform: translate(-45%, -70%) rotate(-45deg);
-ms-transform: translate(-45%, -70%) rotate(-45deg);
transform: translate(-45%, -70%) rotate(-45deg);
}
<span class="checkmark">
<div class="checkmark_circle"></div>
</span>
<span class="checkmark2">
<div class="checkmark_circle"></div>
</span>