While the box-shadow approach is good, it cannot make an elliptical section on the Moon, as in the image in question. The cutout is round and has the same radius as the circle of the container.
If an elliptical section is required, we can either use pseudo-element (or) radial gradients.
Using pseudo-element:
.moon { position: relative; height: 50px; width: 50px; border-radius: 50%; border: 3px solid rgb(29, 27, 28); background: rgb(161, 159, 160); background-clip: content-box; box-shadow: inset 0px 0px 0px 1px rgb(29,27,28); overflow: hidden; } .moon:after { position: absolute; content: ''; height: 100%; width: 120%; top: 40%; left: -12.5%; background: rgb(35, 31, 32); border-radius: 60%/50%; } body { background: rgb(7, 5, 6); }
<div class='moon'></div>
Using radial gradients:
.moon{ height: 50px; width: 50px; background: radial-gradient(ellipse farthest-corner at 33% 100%, rgb(35, 31, 32) 45%, rgb(161, 159, 160) 47%); background-size: 150% 100%; border: 3px solid rgb(29, 27, 28); border-radius: 50%; } body { background: rgb(7, 5, 6); }
<div class='moon'></div>
source share