File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android 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: 1394
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: 1394
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Keeping DIV tags Displayed Correctly
 
Similar Threads
DIV shrinks to fit its content
CSS & DIV relative alignment
Problem hiding div within div
Controlling DIV and/or TR height
Horizontal scrolling with fixed columns