Bookmark Topic Watch Topic
  • New Topic

CSS & DIV relative alignment

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Report post to moderator
HI,

Im kinda new to using DIVs for structuring my website (previously used the ancient and static prehistoric method of tables!).
It all seems pretty straight forwards but I have come across an issue with 'relative' positioning.

How do you make DIV alignment 'relative' to the other divs around it?
By that I mean if I have a DIV(a) that is top/left 0 and has a height of say 50px, and I want another
DIV(b) below it, which is 30px high.
I can set the top of DIV(b) as 50px but if the height of DIV(a) changes then DIV(b) will be wrong. How do I
say that I always want DIV(b)s top to be relative to the height of DIV(a)?

Here is a simple example of a DIV layout that gives me a 'header,'topnav','left nav','body' and a 'footer'.
If I changes the height of 'header' how could I move the top of 'leftnav' and 'topnav' without having to go
thoruhg the CSS and physically make the changes. Also I always want 'body' to be relative to ALL the other DIVs so that it is always inside the topnav, leftnav & foot space.



As my website gets more complex this would become more and more of an issue.

Cheers in advance

===============================================================================

OK, getting a bit closer (I think)

But the problem I have here is that the leftnav is longer than the browser window size and the content div is below the rest of the page layout.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question more than once. As you have re-posted this, I'll close this one.
 
    Bookmark Topic Watch Topic
  • New Topic