css width height not working

sometimes you may find that css width height does not working for html tag b, span,div

i came across it also

i set the position: absolute, then it do work well

below is my css, you can test

.loading
{
    left: 25px;
    position: absolute;
    top: 20px;
    
    background-image: url("./Resources/loading.gif");
    overflow: hidden;
    height: 40px;
    width: 40px;
    background-repeat: no-repeat;
}