This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Keeping DIV tags Displayed Correctly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Keeping DIV tags Displayed Correctly" Watch "Keeping DIV tags Displayed Correctly" New topic
Author

Keeping DIV tags Displayed Correctly

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1436
Using IE 7.0.

I have a main page with three DIV tags:
1. Header width 100% height 10%(float: left)
2. Navigation width 20% height 90%(float: left)
3. Content width 80% height 90%(float: left; overflow: auto)

With in the Content tag I load a JSP with several div tags.

My problem is when the window is sized down the div tags do not stay displayed as designed. The div tags move underneath(bottom) of each other.

I expected the overflow in the above Content div to add scroll bars so the div layout would remain intact.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Problem comes in with odd widths.

Take a look at the Holy Grail article.

Eric
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1436
Eric Pascarello wrote:Problem comes in with odd widths.

Take a look at the Holy Grail article.

Eric


I am still having problems just trying the example given.

When I pad the contents to the left 200px, then set the center contents to 100% width the page scrolls to the right by the 200px.

Why wouldn't a div padded by 200px and set to 100% width just occupy the visible window? Shouldn't the 100% width control this?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Guessing you are not familiar with the box model



Eric
 
jQuery in Action, 2nd edition
 
subject: Keeping DIV tags Displayed Correctly