Can someone explain position:absolute and relative. I understand fixed position but I don't quite get the other two or the uses for them.
Thanks in advance for your help!
Can someone explain position:absolute and relative. I understand fixed position but I don't quite get the other two or the uses for them.
Thanks in advance for your help!
Relative means "relative to where it would normally sit." In other words, if you have an element that's normally seated in the top left corner, you can use relative positioning to move it somewhere else (or, alternatively, define it as a relative positioning element for something with absolute positioning later on).
Absolute means "this element will be positioned here, regardless of document flow." It's based on any relative positioned elements that exist (and the body if none do).
If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.
If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.
My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)
Thanks.Originally Posted by TheGAME1264, post: 243628
Absolute can be manipulated in such a way that the element that you're defining is placed anywhere on the screen, regardless of the position of the parent element or any others. Relative, however, defines its position in relativity to its original position. So if you were to have:
position: relative;
position-left: 20px;
that would move your element 20px to the left (I think, it's been a while.)
I hope that helps.