overlapping divs

Reply

Join Date: Jun 2006
Posts: 27
Reputation: jetru is an unknown quantity at this point 
Solved Threads: 0
jetru jetru is offline Offline
Light Poster

overlapping divs

 
0
  #1
Nov 25th, 2007
I have two divs which both have backgrounds in my CSS properties.

Unfortunately, div2's background overlaps div1's background. But I want it the other way around. In other words, I want div1's background over div2's. I've tried z-index but it didn't work. How do i solve this?
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,203
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: overlapping divs

 
0
  #2
Nov 25th, 2007
You must render the div you want on top last. This means that the div to be on top must be inside the other div in the HTML file.

HTML is not normally supposed to place objects on top of each other. Objects are normally supposed to have their own places on the page without overlap.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 27
Reputation: jetru is an unknown quantity at this point 
Solved Threads: 0
jetru jetru is offline Offline
Light Poster

Re: overlapping divs

 
0
  #3
Nov 26th, 2007
But I would like only a part of the div to overlap the other div...not the whole thing...
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,203
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: overlapping divs

 
0
  #4
Nov 28th, 2007
What do these divs contain. Depending on the content, there may be other ways to do this.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 4
Reputation: cashu is an unknown quantity at this point 
Solved Threads: 0
cashu cashu is offline Offline
Newbie Poster

Re: overlapping divs

 
0
  #5
Dec 1st, 2007
i had the same problem.
thanks
cashu
http://tech-unite.com/forum/viewtopic.php?f=5&t=10
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 247
Reputation: cmills83 is an unknown quantity at this point 
Solved Threads: 1
cmills83 cmills83 is offline Offline
Posting Whiz in Training

Re: overlapping divs

 
0
  #6
Dec 3rd, 2007
z-index property with positioning

divname { position:absolute; z-index:1; }
divname2 { position:absolute; z-index:2; }
probably in a container div
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 247
Reputation: cmills83 is an unknown quantity at this point 
Solved Threads: 1
cmills83 cmills83 is offline Offline
Posting Whiz in Training

Re: overlapping divs

 
0
  #7
Dec 3rd, 2007
then position with top:xxpx; left:xxpx; or right or bottom, etc.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: overlapping divs

 
0
  #8
Dec 6th, 2007
By default, elements that are formatted later in an HTML document are stacked on top of earlier elements. In addition, elements placed with CSS positioning are stacked on top of elements that are not. To specify a different stacking order, use the style

z-index: value

where value is a positive or negative integer, or the keyword "auto". Objects are stacked based on their z-index values, with the highest z-index values placed on top.

The z-index style only works for elements that are placed with absolute positioning. Also, an element's z-index value determines its position relative only to other elements that share a common parent.

So a container div enveloping the other two divs is required.

I hope that helps...stacking objects can get tricky sometimes.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 27
Reputation: jetru is an unknown quantity at this point 
Solved Threads: 0
jetru jetru is offline Offline
Light Poster

Re: overlapping divs

 
0
  #9
Dec 6th, 2007
All these work just fine in firefox. IE just refuses to accept any of these! I tried everything!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC