Zombay Posted February 19, 2011 Share Posted February 19, 2011 Hi! I'm new with CSS and this is probably very stupid question... Is it possible to get div2 under div1 if div1 height changes (onmouseover)? <div style="float:left;position:absolute;width:200px;border: 1px solid #cdcdcd;">div1</div> <div style="float:left;width:200px;border: 1px solid #cdcdcd;">div2</div> I have this image-gallery where you can change image onmouseover and images have different height.. so I would like everything below image-div to change position too... I quess it's not possible if div1 position is set to absolute? Quote Link to comment https://forums.phpfreaks.com/topic/228170-possible-to-position-div-under-a-div-where-position-is-defined-as-absolute/ Share on other sites More sharing options...
cssfreakie Posted February 19, 2011 Share Posted February 19, 2011 yes, this is possible. You should have a look into the property z-index Anything with a state other than static (absolute, relative, fixed position) can have such a z-index. it could look like this: the onclick is javascrit, all you need to do is change the property of the z-index div#first{ position:relative; z-index: 10; } div#second{ position:absolute; z-index: 5; } Btw carefull with naming your div's or elements btw, they may not start with a number. rather give them a logical name Quote Link to comment https://forums.phpfreaks.com/topic/228170-possible-to-position-div-under-a-div-where-position-is-defined-as-absolute/#findComment-1176639 Share on other sites More sharing options...
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.