html - CSS: How to set height of body element to fill rest of total height excluding variable length header and footer -


I would like to create a full-screen HTML such as filling the window with headers, headers, and footers. And, I want to fill the main element with the rest of the height. Therefore, the height of the main element should be (window height - top height - footer height). Header and footer height are not fixed. I can work it using Javascript, but I think it would be better if it is possible to resize through CSS.

Here is what I am trying to do, and is Jasfield

  .header {height: 30px; Width: 100%; }. Silence {Position: Absolute; Width: 100%; Height: 50%; } .footer {status: complete; Bottom: 0 pixels; Width: 100%; } .content {position: absolute; Height: 100%; Width: 100%; } & Lt; Div class = "content" & gt; & Lt; Img src = "http://mrg.bz/ccyR3V" square = "header" & gt; & Lt; Img src = "http://mrg.bz/qmVoy1" class = "main" & gt; & Lt; Div class = "footer" & gt; Here footer is not altitude & Lt; / Div & gt; & Lt; / Div & gt;  

In this jsfiddle, I want to fill the main element between the top element and the footer.

Any ideas?

Use:

... Also, the main content should not be img , it can be a div a, a and so on.

  * {margin: 0; Padding: 0; } Html, body {height: 100%; } .hader {height: 30px; Width: 100%; } .mainWpr {height: 100%; }. Men {Width: 100%; Height: 100%; } .footer {width: 100%; }. Content {height: 100%; Width: 100%; Display: Table; } .content & gt; Div {Display: Table-Line; }  
  & lt; Div class = "content" & gt; & Lt; Div & gt; & Lt; Img src = "http://mrg.bz/ccyR3V" square = "header" /> & Lt; / Div & gt; & Lt; Div class = "mainWpr" & gt; & Lt; Img src = "http://mrg.bz/qmVoy1" class = "main" /> & Lt; / Div & gt; & Lt; Div & gt; & Lt; Div class = "footer" & gt; Here is the footer height is not fixed. Here is the footer. The height is not fixed. Here is the footer. The height is not fixed. Here is the footer. The height is not fixed. Here is the footer. The height is not fixed. Here is the footer. The height is not fixed. Here is the footer. The height is not fixed. Here is the footer. The height is not fixed. Here is the footer .. & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;  


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -