How does this CSS produce a circle exactly applying the half of equal width/height?
div{
width: 200px;
height: 200px;
border-radius: 100px;
background-color: red;
}
How does this CSS produce a circle exactly applying the half of equal width/height?
div{
width: 200px;
height: 200px;
border-radius: 100px;
background-color: red;
}
Read this explanation and everything will be clear :)
How it Works
Rounder corners can be created independently using the four individual border-*-radius properties (border-bottom-left-radius, border-top-left-radius, etc.) or for all four corners simultaneously using the border-radius shorthand property.
It is because of your border-radius. You set it to be 100 pixels which is exactly half of the original square, so it will turn it into a circle. Try doing:
div{
width: 200px;
height: 200px;
border-radius: 10px;
background-color: red;
}