#container
{
position: relative
}
Now any element within this container will be positioned relative to it. Say you had this HTML structure:
<div id="container"><div id="placement">...</div></div>
To position the navigation exactly 15px from the left and 2px from the top of the container box, you could use these CSS commands:
#placement
{
position: absolute;
left: 15px;
top: 2px
}
Perfect! In this particular example, you could of course also use
margin: 15px 0 0 20px
, but there are some cases where it is preferable to use positioning.
No comments:
Post a Comment