I am making a website, it has just few lines and I just made its structure to see how it will look, and till now I thought I understand what means “Relative” position in CSS.
Here is my HTML and CSS code. If you take a look at CSS you will see in #about div
position: relative;
top: 13%;
In #portfolio
position: relative;
top: 0;
but its not on top of #wrap div. If I change its position to absolute it will be on top. So my question is: #portfolio div is relative to what? I thought It should be relative to wrap I think and it should change its top position relatively to wrap.
(Sorry about formatting of this post if you will be so nice to format it better it will be just great, i tried but it was horrible)
position: relative;causes the item to be positioned relative to where it would be if you did not specify that option. The item still takes up the same ‘space’ as it would have, but may be moved. This does not have anything to do with positioning it within its parent.For instance:
Will cause the item to be moved 5 pixels down from where it would otherwise be.
Would cause it to move 5 pixels up from where it would otherwise be.
Also note that it’s possible to cause the object to overlap others or be moved outside of its parent by using this, depending on how much you offset it.