# October 27, 2008 at 10:59 am
This reply has been reported for inappropriate content.
One isn’t better than the other, they are totally different types of positioning. You can think of relative positioning as "relative to itself". So if you gave and element left: -5px, it would appear five pixels to the left of where it normally would. With absolute positioning, if you gave it left: -5px, it would be positioned literally like that -5px was a horizontal coordinate, so it would be all the way to the left of the browser window and 5px to the left beyond that.
It’s important to remember though that you can limit the "scope" of absolute positioning by giving a parent element relative positioning. I know, it’s weird.
http://css-tricks.com/absolute-position … sitioning/
http://css-tricks.com/absolute-relative … ey-differ/# October 27, 2008 at 8:06 pm
When you use absolute positioning, it takes the element outside of the normal flow of the document. This can come in pretty handy. If you a box, 250 pixels by 250 pixels, and you need to attach an image in the lower right corner – regardless of how much content is in the box there are a couple of different ways you can try and go about it, but the easiest, by-far, would be to just set the positioning of the parent container (the box) to relative, and then give the image a position of relative, bottom: 0, and right: 0.
Look at this page, see the elements attached to the bottom of the page. That would be pretty difficult to accomplish trying to use floats and margins.
You must be logged in to reply to this topic.