boltonw 0 Posted October 19, 2010 Report Share Posted October 19, 2010 Hi,The following code acts like relative positioning instead of absolute. The first image is positioned at left:280px; top:560px but the second image is positioned at 0,0 but instead of being positioned at the upper left corner of the page, the image is positioned at the upper left of the first image, just like a relative position. Originally, I did not have the size of the DIV in the code, but it made no difference as well.Thanx,BBBCODE:<body bgcolor="#FFFFFF"> <div id="specials" style="position:absolute; left:280px; top:560px; width:516px; height:29px; z-index:1"> <IMG src="images/daily_specials.jpg" WIDTH="516" HEIGHT="29" BORDER="0" ALT=""> <div id="rueben" style="position:absolute; left:0px; top:0px; width:161px; height:41px; z-index:2"> <IMG src="images/grilled_rueben_btn.jpg" WIDTH="161" HEIGHT="41" BORDER="0" ALT=""></body></html> Quote Link to post Share on other sites
ShadowMage 94 Posted October 19, 2010 Report Share Posted October 19, 2010 Try closing your div tags:<div id="specials" style="position:absolute; left:280px; top:560px; width:516px; height:29px; z-index:1"><IMG src="images/daily_specials.jpg" WIDTH="516" HEIGHT="29" BORDER="0" ALT=""></div><div id="rueben" style="position:absolute; left:0px; top:0px; width:161px; height:41px; z-index:2"><IMG src="images/grilled_rueben_btn.jpg" WIDTH="161" HEIGHT="41" BORDER="0" ALT=""></div> Quote Link to post Share on other sites
justinbriggs1 0 Posted October 19, 2010 Report Share Posted October 19, 2010 Looks like you didn't use a closing div tag around your images. Are you trying to do this?: <div style="position: absolute; width: 516px; height: 29px; z-index: 1; left: 280px; top: 560px;" id="specials"> <img alt="" src="images/daily_specials.jpg" width="516" border="0" height="29"></div><div style="left: 0px; top: 0px; width: 161px; height: 41px; z-index: 2; position: absolute;" id="rueben"> <img alt="" src="images/grilled_rueben_btn.jpg" width="161" border="0" height="41"></div> Quote Link to post Share on other sites
boltonw 0 Posted October 19, 2010 Author Report Share Posted October 19, 2010 Thanks all !!! <blushes furiously> If it had been a brick, I would have stubbed my toe!BBB Quote Link to post Share on other sites
Synook 47 Posted October 20, 2010 Report Share Posted October 20, 2010 By the way, this (positioned relative to the top left corner of the parent) is the expected behaviour for position:absolute if the parent is positioned relatively. position:relative, on the other hand, positions the element relative to where it would be otherwise, if no positioning was applied.P.S. don't forget to validate your code, and a lot of these issues can be easily avoided. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.