Answers for "height not working on div"

2

why is height: 100% not working

/*this is how to make height: x% work in HTML. you have to set the 
height of the body to 100vh or nothing will happen regarding height 
of the element.*/

<html>
  <head>
    <style>
      body {
        height: 100vh;
      }
      #box {
        width: 20px;
        height: 100%;
      }
    </style>
  </head>
  
  <body>
    <div id = 'box'></div>
  </body>
</html>
Posted by: Guest on July-20-2021

Code answers related to "height not working on div"

Browse Popular Code Answers by Language