Jump to content

aligning Div's


johnsmith153

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.