The problem of aspect ratio in css

< div id=box >

<img src="">

< / div >

< H1 > box {< / H1 >
overflow: hidden
height: 0
padding-bottom: 43.372rem

}
at present, the width and height of 1rem = 50px pictures are 640276 respectively. How is the value of the aspect ratio padding-bottom calculated

Apr.11,2021

according to the title and description, you want the aspect ratio of the box to be equal to 640 container 276 of the picture, then the padding-bottom should use the percentage, whose actual pixel value reference is the parent container width of the image. In this case, the value of padding-bottom should be 276 over 640 * 100% = 43.125%

actual dom structure


        <img/>
    </div>
</div>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38169-2b44c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38169-2b44c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?