Account
Categories
Shobha
Shobha
The best way to predict the future is to invent it

What is the difference between position: relative and position: absolute?

position: relative moves an element from its normal position without affecting the layout around it. In contrast, position: absolute removes the element from the document flow and positions it relative to the nearest positioned ancestor. For example,

.relative { position: relative; top: 10px; }
.absolute { position: absolute; top: 20px; left: 10px; }