html - How to make container div height of page at all times, with no content overflow? -


I'm trying to create a simple webpage where it has a focused div with content so far I have a lot easier It was time, but I've hit a roadblock: when the browser window is less than the main content, then the content "spreads" (example :)

I saw a lot of tutorials / similar questions Is it, but I think that's going to fulfill my needs Can not find OS:

  • Contains container (most solutions position: fixed , which usually aligns to the left side of the container divas page
  • Keeps the container at the top of the window even when placed in the shape
  • Allows scrolling when the window INS usually terminates the scroll bar, so only one of the content shows Share

    Here is my code:

    (CSS)

      # Container {width: 900px; height: 100%; margin: auto auto auto auto; padding: 1px; background-image: url ('img / light_tost page');} #mainHeader {margin: 30px 30px 10px; Padding: 0px;} #mainContent {margin: 0px 80px 0px 80px; Padding: 1px;}   

    (html)

      & lt; Div id = "container" & gt; & Lt; Div id = "mainHeader" & gt; & Lt; H1 id = "msg" align = "center" style = "margin: 0 auto" & gt; Header text & lt; / H1> & Lt; / Div & gt; & Lt; Div id = "main content" & gt; & Lt; P id = "par1" & gt; & Lt; / P & gt; & Lt; P id = "par2" & gt; & Lt; / P & gt; & Lt; P id = "par3" & gt; & Lt; / P & gt; & Lt; P id = "par4" & gt; & Lt; / P & gt; & Lt; P id = "par5" & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt;    

    It can be tricky and a lot of the techniques that can work for you or Special cases may occur.

    Try:

    • < / Div>

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -