chemo Posted November 30, 2006 Share Posted November 30, 2006 Can someone please explain to me the difference between position absolute and position relative? Link to comment Share on other sites More sharing options...
Skemcin Posted November 30, 2006 Share Posted November 30, 2006 http://webdesign.about.com/od/beginningtut...a/aa040502a.htm Link to comment Share on other sites More sharing options...
jesh Posted November 30, 2006 Share Posted November 30, 2006 In my experience, absolutely positioned elements are sort of removed from the rest of the content and placed in their own layer. Relatively positioned elements stay with the rest of the content.Look at how these two pages differ when viewed in a browser:RELATIVE: <html><head><style type="text/css">div { width: 200px; height: 200px; }#block1{ background-color: #cccccc; position: relative; left: 40px; }#block2{ background-color: #ffff8c;}</style></head><body><div id="block1">This is div one.</div><div id="block2">This is div two.</div></body></html> ABSOLUTE: <html xmlns="http://www.w3.org/1999/xhtml" ><head><style type="text/css">div { width: 200px; height: 200px; }#block1{ background-color: #cccccc; position: absolute; left: 40px; }#block2{ background-color: #ffff8c;}</style></head><body><div id="block1">This is div one.</div><div id="block2">This is div two.</div></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now