DIV layer with 100% height, the Javascript way | TimeWaster's Place

When you create a div layer with 100% width and height, the height is always only the height of the browser window, not of the page content (which can be much higher).

To solve this, give the layer div an id and use the following JS code inside the layer div:

The code is very simple, it gets the height of the content (the body element) and gives it the layer div.

Tested in Opera, Firefox and *barf* MSIE (8).

Email

Facebook

Thanks, I needed to resize a div to the height of the window and this did the trick perfectly.

Really great thing, solves all problems.

Thank You, you are a god! I spend the whole day looking for this.

grax thanks solves all problems

Excellent trick, fixed my problem!

Name (required)

Mail (will not be published) (required)

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

Categories Design Modellbau Plugins Programming Tools Various

Design

Modellbau

Plugins

Programming

Tools

Various

Advertisement

Please donate Please donate a small amount if you like my scripts and want to support my projects!

Please donate a small amount if you like my scripts and want to support my projects!

Subscribe to Blog via Email Enter your email address to subscribe to this blog and receive notifications of new posts by email. Join 2 other subscribers

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Recent Comments Andres on DIV layer with 100% height, the Javascript way Bob Coyle on Arduino: String and Float admin on Arduino: String and Float admin on Arduino: String and Float Varun on Arduino: String and Float

Andres on DIV layer with 100% height, the Javascript way

Bob Coyle on Arduino: String and Float

admin on Arduino: String and Float

Varun on Arduino: String and Float

Archives Select Month July 2012 January 2012 November 2011 March 2011 January 2011 July 2010 June 2010 May 2010 March 2010 January 2010 December 2009 November 2009 October 2009 August 2009 July 2009 June 2009 February 2009 December 2008 September 2008

Linkliste CraZy Vikings – A german multigaming clan Devilmastah's Blog Viiideeeooo – A HTML 5 demonstration

CraZy Vikings – A german multigaming clan

Devilmastah's Blog

Viiideeeooo – A HTML 5 demonstration

Pages About me Impressum

About me

Impressum

Posts & Comments RSS - Posts RSS - Comments

RSS - Posts

RSS - Comments