#outerDiv {
width: 770px;
margin: 0 auto;
position: relative;
background: #fff url(../images/banner.jpg) no-repeat;
}
the above div will be in middle of page and it will be a start reference for other tags having absolute position.
#insideDiv{
position: absolute;
width:30px;
background: #eee
background: #eee
top: 0;
}
if in outerdiv we did not have position:relative the insidediv would start from body but when we have position:relative it starts from outer div.
So Relative just means you are creating a reference for
absolute positioning.
No comments:
Post a Comment