1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Css Positioning

Discussion in 'CSS' started by ellias2007, Nov 16, 2010.

  1. #1
    Hi every body,
    i need to position an inner div into an external one, and i need to positioning the inner one absolutely with respect to the external div and Not with respect to all the page ... when i set the position to the inner div to "absolute" with some coordinates, the inner div is positionned absolutely with respect to ALL the page and Not w-r-t its Parent ....
    Please help me :
    HOW to positioning an inner div w-r-t an external one (its Parent)
    Many thanks
    :rolleyes:
     
    ellias2007, Nov 16, 2010 IP
  2. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Is there any URL to show your markup and css?
     
    radiant_luv, Nov 16, 2010 IP
  3. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #3
    Absolutely positioned elements are always placed relative to the nearest positioned parent element. Make your parent div 'position:relative' to do what you want.
     
    drhowarddrfine, Nov 16, 2010 IP
  4. ronc0011

    ronc0011 Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I was thinking that "absolute" takes the element out of the page flow.

    This is probably the best explanation I've seen on CSS positioning
     
    ronc0011, Nov 17, 2010 IP
  5. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #5
    It is. The normal page flow would force the element to be placed in descending order down the page. Absolutely positioning it positions the element relative to its nearest positioned element which would be the body. By 'positioning' the parent of the absolutely positioned element, you anchor it to the parent.
     
    drhowarddrfine, Nov 17, 2010 IP
  6. ronc0011

    ronc0011 Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    OK, yeah I see what you're saying. I would've used a float with margins to position it or no margins to stick it to the upper left or right corner.
     
    ronc0011, Nov 17, 2010 IP