Block element added set border and border-radius pseudo element after, and then set absolute positioning why it will become a circle?

1. Describe your problem:

I have a block element. When I set the : after pseudo element to this element, and set the attributes border , border-radius , and then set absolute:position , it will make the pseudo element become a circle. Why?

2. Here is my code:

   

Css
May.06,2022

Emmm, why can't it be round?

you set the border width to 10px border: 10px solid-sharp000;
and then set the border fillet greater than 10px / 2 = 5px border-radius:50px;
so it has a round border, and its height width is all 0, position:absolute;content: "; .

there is no content, no width and height, and the frame is round, so it should be round.


Why does it become round? the style you write is to write it as round


you have set border-radius , why won't it become round? If you do not set the width and height of the pseudo element, then it is opened by its border border . At this time, it can be regarded as 20px , and then the border-radius is more than half of its width and height, and it becomes a circle.

I found out why on CSS: display:inline-block and positioning:absolute . The pseudo element is a inline element, so its height is the height of the browser's default font size 16px . When the inline element is set position:absolute , it is detached from the document stream and no longer displays the height unless the height attribute is set. So after setting position:absolute , it will act as a block element. Will be displayed as a circle.

Menu