D
D
Dmitry Rudenko2021-06-24 12:05:30
css
Dmitry Rudenko, 2021-06-24 12:05:30

Why is the pseudo element smaller than the parent?

Good afternoon. Can you please tell me why the pseudo-element is smaller than the parent?
Above is a span and below is a pseudo element Span
60d44aa89c876735031688.png
Styles:
.header__burger-btn span {
width: 100%;
height: 1px;
border: 2px solid #202020;
position: absolute;
}
Pseudo element style:
.header__burger-btn span::before {
content: "";
position: absolute;
width: 100%
height: 100%;
top: 10px;
border: 2px solid #202020;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iBird Rose, 2021-06-24
@M1sty1

because in width width: 100%; the pseudo-element does not have a parent border

S
Sergey delphinpro, 2021-06-24
@delphinpro

The pseudo-element is inside the parent. And occupies 100% of its internal width .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question