SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2001
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Relative Positioning

    Is there any way to position an element relative to the position of another element in a page? I've tried using the relative attribute of the position property, but that just seems to position it relative to where the preceding element would be if the page was plain HTML, as opposed to where the CSS-placed element actually *is*.

    Huntress

  2. #2
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The relative attribute is used to position an element relative to the container element. I don't think it's possible, using just css, to position an element(1) according to the position of another element(2) position if 1 isn't within 2.

    Could you give us some more details as to what you're trying to acheive? There may be a simple way around the problem or it may require some scripting.

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you are trying to absolutely position element #1, then relatively position element #2 in relation to #1. Is that correct?

    If it is, then try creating a DIV that is absolutely position. Put it where you want it, then put #1 and #2 inside that DIV. #1 will position itself to the top left of the DIV, then #2 will be relative to #1 and in the right position.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  4. #4
    SitePoint Member
    Join Date
    Jul 2001
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    It worked

    Shane: Thanks, I just needed to put the elements I wanted to position inside a container element.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •