Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS 100% height + header with static height;

I am building a layout which includes a header, which is 40 px in height. Underneath this header a SWF resides that should take up the rest of the available space.

The best solution untill now has been working with a table, giving the first row 40px height and the second row a 100% height - but these rows still add up in Internet Explorer, resulting in a scrollbar appearing for 40 extra pixels - which should not be the case.

I tried using this: http://www.456bereastreet.com/archive/200609/css_frames_v2_fullheight/ - it works fine if you have content that pushes down eventually but with a SWF with 100% in it, it will take over the whole page, or half the page (depending on putting the SWF in the content div or the SWF being the content div).

Before I resort to javascript to take care of this business I am wondering if someone else knows a better solution?

like image 692
Kasper Avatar asked Apr 27 '09 19:04

Kasper


People also ask

How do I change my height to 100% in CSS?

Syntax: To set a div element height to 100% of the browser window, it can simply use the following property of CSS: height:100vh; Example: HTML.

Can you add height for a header?

To change the height of header or footer, you can drag the height bigger or smaller as you need in Page Layout view. Then dragging the top margin up or down as you need to change the height of the header.

How do I make my div take 100% height of parent div?

Answer: Set the 100% height for parents too And we all know that the default value of the height property is auto , so if we also set the height of <body> and <html> elements to 100%, the resulting height of the container div becomes equal the 100% height of the browser window.


1 Answers

Try setting your header as static. So it floats over the main body, and set the main body to 100% height. Then give the body a 40px padding on the top.

like image 112
Nick Berardi Avatar answered Sep 30 '22 13:09

Nick Berardi