But the problem is i cannot use the big image as background !! it has to be inside an <img> tag and the small image on top of it!!
It has to be an IMG tag? That's stupid. If it's going behind another image then it truly is a background, so your requirements are ridiculous.
I see no reason for doing it this way, but whatever you say...
You will need to use absolute positioning to accomplish this then.
Best regards...
The requirement is such that both images loads dynamically, when you click on the small image (top) the bottom image changes/modifies accordingly - that was the reason i am not able to have that as a static background. Thanks.
Pfff, you call that a reason?! That's a dumb reason to disregards background images!! You can change them just as easily/dynamically as you would otherwise. Keep an open mind, instead of instantly saying "Oh, I cant use background images NO WAY!!!"
That's right: you can use javascript to change the background image of the bottom div. just add a javascript function that changes the background-image property of the bottom div and call the function on the onclick() of the image in the top div.
Alrighty, here it goes - i am creating a web map and trying to place a slider on top of the map. The map should be inside a div and the slider on top of the map should also be in a div !!!!!!!!!!!!!!!!!!!!!!
The slider div will get rendered after the map div and the negative margin will draw on top of the map div. You would have to adjust the margin-top value accordingly to whatever adjustment you would need.
-=JW=-
Marked as answer by me_myself on Oct 08, 2007 09:32 PM
me_myself
Member
17 Points
31 Posts
Re: DIV on top of another DIV without absolute positioning ?!
Oct 08, 2007 08:39 PM|LINK
The requirement is such that both images loads dynamically, when you click on the small image (top) the bottom image changes/modifies accordingly - that was the reason i am not able to have that as a static background. Thanks.
JoshStodola
Star
13736 Points
3177 Posts
Re: DIV on top of another DIV without absolute positioning ?!
Oct 08, 2007 08:43 PM|LINK
Pfff, you call that a reason?! That's a dumb reason to disregards background images!! You can change them just as easily/dynamically as you would otherwise. Keep an open mind, instead of instantly saying "Oh, I cant use background images NO WAY!!!"
jjwhite
Member
251 Points
55 Posts
Re: DIV on top of another DIV without absolute positioning ?!
Oct 08, 2007 08:47 PM|LINK
That's right: you can use javascript to change the background image of the bottom div. just add a javascript function that changes the background-image property of the bottom div and call the function on the onclick() of the image in the top div.
My Site
me_myself
Member
17 Points
31 Posts
Re: DIV on top of another DIV without absolute positioning ?!
Oct 08, 2007 08:53 PM|LINK
Alrighty, here it goes - i am creating a web map and trying to place a slider on top of the map. The map should be inside a div and the slider on top of the map should also be in a div !!!!!!!!!!!!!!!!!!!!!!
Any ideas please ;)
jamezw
Participant
1211 Points
190 Posts
Re: DIV on top of another DIV without absolute positioning ?!
Oct 08, 2007 09:18 PM|LINK
How about if you place the top div below the bottom div and then use a negative top-margin on the top div something like this:
<div id="bottom"> <img alt="map" src="map.jpg" /> </div> <div id="top" style="margin-top: -100px;"> <img alt="slider" src="slider.jpg" /> </div>The slider div will get rendered after the map div and the negative margin will draw on top of the map div. You would have to adjust the margin-top value accordingly to whatever adjustment you would need.
me_myself
Member
17 Points
31 Posts
Re: DIV on top of another DIV without absolute positioning ?!
Oct 08, 2007 09:31 PM|LINK
Works like a Charm :) Thanks jamezw.
Thank you guys for all your support. This forum rocks !!