Multiple vertical 100% height & width divs

后端 未结 2 1438
挽巷
挽巷 2021-01-24 05:38

I\'m trying to create multiple divs with 100% both width & height, but keep failing miserably. Example:



    
2条回答
  •  暖寄归人
    2021-01-24 06:05

    The solution is first reset default values for margin and padding:

    * {
      margin:0;
      padding:0;
    }
    

    Second make your html and body be the 100%:

    html, body {
       height:100%;
    }
    

    Then your dimension for divs:

    #wrapper, #one, #two {
       width:100%;
       height:100%;
    }
    

    You can't assign numeric values for id or class on the first charachter

    The demo http://jsfiddle.net/3fCZg/

提交回复
热议问题