Difference between absolute and relative positioning

There are two types of positioning: absolute and relative. Absolute positioning will place an element absolutely on your page. You can specify the exact pixel location. If you want to place an image to appear 50 pixels from then top of the page and 50 pixels from the right, you can do this:

img { position: absolute; top 50px; right 50px; }

While relative means you are positioning it from the normal position. You can use it to draw x2. The letter x in this case is the normal position and you are positioning the power 2 relative to the letter x. The code is:

position: relative; bottom:4px; left: 1px;

You should remember that if you want to move something right, you use the right code, and vice versa.

Nov 6, 2008 by
GreenGeeks WP Web Host ad ad ad ad