Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
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: 1446
    
    1
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: 1446
    
    1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Keeping DIV tags Displayed Correctly