Help - Search - Members - Calendar
Full Version: div layer positioning: absolute? relative?
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
Markasey
I'm having a hard time laying out a page here. I have the full table inside a #container div which is positioned: absolute.

Then a #nav layer using relative positioning. I could see that making it "0" position left was taking it to the left edge of the container-- which is where I wanted it.

My problem comes in when I try to add another layer for the page text. If I make it "relative" -- the #nav div disappears. If I make it absolute, I can still see the #nav layer but the positioning is all messed-up. Can't I have 2 layers positioned relatively within a container?

Here are my test files: http://www.markasey.com/ that is, of course, my index page and then if you click on "home" you'll see what happens if I made the #text layer "relative" -- no navigation bar (yet the code is there)

Sorry to be so long-winded -- I hope that makes sense and someone has some ideas for me. Thanks, Mark
pandy
I think you misunderstand what 'position: relative' does. It positions the box with an offset relative to where it would be had it not been positioned. You could say you push it away from its orginal position.

QUOTE
Then a #nav layer using relative positioning. I could see that making it "0" position left was taking it to the left edge of the container-- which is where I wanted it.


Which means that's where it would have been anyway, had you done nothing.

If I follow your description you first had an AP box. AP takes it out of the "flow", it doesn't affect other content on the page. So when you add more content it will begin in the top left corner, just as if it had been alone on the page, only the AP box will be on top of it. Did that make any sense? blush.gif
Markasey
Oh wow..now I'm really confused. So if I take out positioning altogether, it should stay where I position it in Dreamweaver?
pandy
Don't ask me about DW. I type. tongue.gif
Markasey
that's what I meant-- type-- not DW smile.gif So how does the layer know where to sit if there's no positioning?
Markasey
Oh, re: AP box. DW ( which I do NOT use tongue.gif) just gave it that name. I had no idea the AP did something else. Maybe I'll just rename it and play with it without the AP.
pandy
It isn't a "layer" if it isn't positioned. As I understand it "layer" is DW talk for an (absolutely?) positioned element.
pandy
QUOTE(Markasey @ Jul 10 2008, 03:00 AM) *

Oh, re: AP box. DW ( which I do NOT use tongue.gif) just gave it that name. I had no idea the AP did something else. Maybe I'll just rename it and play with it without the AP.


Definitely do. There's nothing wrong with AP, but you should know what you are doing and don't use it if it isn't needed. Don't use anything that isn't needed. tongue.gif

I have no experience with DW, but from what I see it favors AP as do all WYSIWYG editors. They aren't smart enough ti use it in a clever way, they just position everything relative the browser window's top left corner (in best case).
Markasey
QUOTE
They aren't smart enough ti use it in a clever way, they just position everything relative the browser window's top left corner (in best case).


Which makes no sense to me. Your site would look different on every computer, right? This is my problem. Well thanks for your help anyway. You have given me some ideas to play around with. I'll let you know how it goes. Maybe I'll teach you some DW tricks one day wink.gif haha
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.