I am applying overflow property on before and after pseudo-elements. I am not able to get this behavior after that being applied.
p {
border: 3px solid green;
background-color: rgb(177, 215, 252);
}
p::after{
content: "hello";
background: red;
display: inline-block;
width: 100%;
}
Before applying overflow:hidden
to p::after
it appears like this:
After applying overfow:hidden
to p::after
it appears like this:
My question is what is this behaviour ? How overflow is working with pseudo element here.
One more thing i noticed is that it only happens when display is set to inline block. Below is the example.
1.
p::after {
content: "hello";
background: red;
overflow: hidden;
}
2.
p::after {
content: "hello";
background: red;
display: inline-block;
overflow: hidden;
}