johnsmith153 Posted October 4, 2008 Share Posted October 4, 2008 I need to align divs very smply div1 div2 div3 div4 div5 however, I need to enter them in the .html in the order: div2 div3 div1 div4 div5 (odd I know, but trust me) How do I make div1 go up a set number of pixels reltive to its position? I would have thought position:relative;bottom50px would work but it doesnt Quote Link to comment https://forums.phpfreaks.com/topic/127022-aligning-divs/ Share on other sites More sharing options...
dropfaith Posted October 4, 2008 Share Posted October 4, 2008 first of all why would you need to do this? just wondering as there may be a better way to code this Quote Link to comment https://forums.phpfreaks.com/topic/127022-aligning-divs/#findComment-657101 Share on other sites More sharing options...
johnsmith153 Posted October 4, 2008 Author Share Posted October 4, 2008 I have various divs generated based on database results etc. One search result needs an additional message displaying - hence this, and not for every occasion. Everything is position to the nearest 1 pixel, so is very precise. The key thing is that I can insert something without generating line breaks. I know it sounds odd, and just displaying a div to start at x200px, y100px would do it, however I can't do exactly this as I have collapsable panels, and obviously when I collapse it would all go wrong. I probably havent expalined myself, but the ability to position something relative to another div is the key, and without generating line breaks. position:relative sounds the thing, but can't get it to work. Thanks, I see you must be a CSS expert dropfaith (or freak that should be I suppose) - I see you like the CSS forum. Quote Link to comment https://forums.phpfreaks.com/topic/127022-aligning-divs/#findComment-657139 Share on other sites More sharing options...
dropfaith Posted October 4, 2008 Share Posted October 4, 2008 well with relative it is always relative to the container it is in and not to a div placed somewhere on the page.. this might be better with js honestly to only show the div if the criteria was met to get that data so if search for test display div id test? css doesnt seem like the best way to do this as any answer i dont think will be cross browser using relitive and absolutes doesnt have the best results cross browser Quote Link to comment https://forums.phpfreaks.com/topic/127022-aligning-divs/#findComment-657161 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.