CSS height in % not working?



  • Why, when you write in your height, it's okay, and when in percentages, like the drawing, nothing works? You can't do height as a percentage?

    <!DOCTYPE html>
    <html>
        <head>
            <script type="text/javascript" src="home_page.js"></script>
            <link rel="Stylesheet" href="accaunt.css"/>
            <meta http-equiv="content-type" content="text/html; charset=windows-1251"/>
            <style type="text/css">
                body.style_body {
                    background-attachment: scroll;
                    background-clip: border-box;
                    background-origin: padding-box;
                    direction: ltr;
                    display: block;
                    margin: 0px auto;
                    overflow: scroll;
                    padding: 0px;
                    position: relative;
                }
                .gods_area {
                    background: #d954ff;
                    border-bottom: 2px solid black;
                    height: 82%;
                    margin: 0px;
                    padding: 0px;
                    width: 100%;
                    z-index: 10000;
                }
            </style>
            <title>School.ua</title>
        </head>
        <body class="style_body">
            <div id="gods_area" class="gods_area"></div>
        </body>
    </html>
    


  • If you take interest, you have to take it from something. So either write as stated above.

    body, html{height:100%}
    

    or indicate the same in the parent element.

    body.style_body { height:100%}
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2