Why can't the image size be set by the content attribute in pseudo-elements?

div::before {
content: url ("a.png");
display: block;
width: 100px;
height: 100px;
object-fit: fill;
}

The reason why the picture introduced by the content attribute of the

pseudo element cannot set the size to show its inherent size is that its default attribute is boject-fit: none?.
if not, why can"t it be set?
if so, then I have already set up object-fit: fill. Why can"t I set it yet?

Jul.17,2021

object-fit is the style of img . Although pseudo elements can be used to set pictures, they are not img

after all.

you can use the background picture, and then use background-size:cover

div::before{
content: '';
display: block;
width: 100px;
height: 100px;
background:url('a.png')
background-size:cover;
}
Menu