Click to See Complete Forum and Search --> : help with DIV


khurley
04-15-2003, 09:33 AM
Anyone know how I can make a DIV container's position - relative to another landmark on the HTML page?

I have a floating menu in DIV tags. It currently covers some graphics at the top of the page on load. I want it to be beneath the graphics for starters - then follow me down the page at about the same position it was covering the graphics to begin with....make sense?


Thx,

khalidali63
04-15-2003, 10:58 AM
read about z-index css property may be here

http://www.w3.org/TR/REC-CSS2/visuren.html#propdef-z-index

Cheers

Khalid

nkaisare
04-15-2003, 11:06 AM
If two divs are overlapping, z-index property will determine which div is placed on top:

--------------------
| |
| z-index: 1 |
| |
| --------------------
-----| |
| z-index: 2 |
| |
--------------------



--------------------
| |
| z-index: 2 |
| |
| |-----
-------------------- |
| z-index: 1 |
| |
--------------------


Do you mean that the two divs should not overlap?

With the following, the image and text won't overlap:
<div><!-- No styles here -->
<img src="image.gif" alt="Alt Text">
</div>
<div><!-- Again, no styles reqd -->
Blah Blah Blah
</div>

For a tutorial on absolute and relative positioning,
http://www.w3schools.com/css/css_classification.asp