July 2, 2012

100% left div section required

Question by user1356607

I have two divs (red and yellow). Red div has 100% height and Yellow div in fixed 1000 pixel. I want red div 100% of the window screen even I scroll down the page, but it is not taking 100% height of the browser screen. I tried to find so many examples but failed to resolve my issues. Please guide…

Here is the example i have done.

http://jsfiddle.net/awaises/Ff6v5/

Answer by Mateusz Kocz

Is this what you want?

Then you need to change three things:

  1. body’s and html’s height to min-height;
  2. body’s and html’s position to relative;
  3. you don’t need !important in .left-menu’s height.

Answer by Starx

It doing what it is suppose to do !!!

This is really a misunderstanding.

Your style of height: 100% applies to .left-menu. But inside this .left-menu, you have another div called .left-footer, which has green as its background. So, the CSS is doing what is coded to do.

It order to span the red above the entire left area, you dont have to do anything. It is already doing that. For the proof see this.

So, there is nothing to fix. This is a design flaw.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!