div height 100 percent

后端 未结 2 812
既然无缘
既然无缘 2020-12-16 15:39


css

body{
    max-wid         


        
2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-16 15:57

    There are a few options you may find useful:

    vh (viewport height) vw (viewport width) vmin (viewport minimum length) vmax (viewport maximum length) Now, let’s have a look at a real example. Imagine you want to create a website with two sections, each one of them with the size of the browser window.

    Here’s just a simplified code example of the HTML:

    your content on screen 1
    your content on screen 2

    and here’s the CSS using vh:

    div#welcome {
        height: 100vh;
        background: black;
    }
    
    div#projects {
        height: 100vh;
        background: yellow;
    }
    

    You can see more in:

    http://stanhub.com/how-to-make-div-element-100-height-of-browser-window-using-css-only/

提交回复
热议问题