According to the browser adaptive div height, after I set the height to a percentage, it is still invalid

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        -sharpdd {
            width: 100%;
            height: 100%;
        }
        -sharpdd1 {
            width: 20%;
            height: 20%;
            background-color: -sharpF17A7A;
        }
    </style>
</head>
<body>

<div id="dd">
    <div id="dd1">
        111
        222
        2222
    </div>
</div>

</body>
</html>
Apr.02,2021

dom the css style of the object inherits its parent, so the height of html,body needs to be set to 100% so that the height of div can be 100% adaptive.


html,body {

height: 100%;
width: 100%;

}


-sharpdd {
            width: 100vw;
            height: 100vh;
        }
        -sharpdd1 {
            width: 20vw;
            height: 20vh;
            background-color: -sharpF17A7A;
        }

you can try vh

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-1e4d635-44f31.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-1e4d635-44f31.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?