position
property gives developers more control over where
elements should appear
position:relative
and change the top
,
bottom
, left
, or right
values
Move <span style="position:relative; top:-1ex">UP</span>,
<span style="position:relative; bottom:-1ex">DOWN</span>,
<span style="position:relative; left:-1ex">LEFT</span>, and
<span style="position:relative; right:-1ex">RIGHT</span>!!!!
<span style="position:fixed; right:50px; bottom:5px; color:red">Fixed</span>
Fixed
position:absolute
and speicify the distance from
the top
,
bottom
, left
, or right
margins of its containing block-level element
<span style="position:absolute; left:10px; top:5px; color:red">Absolute</span>
Absolute
See the word Absolute positioned 10 pixels from the web page's left edge and 5 pixels from the
top of the web page
<div style="position:relative; left:20px; top:0px; border:1px solid green;
height:80px; width:300px">
<span style="position:absolute; left:10px; top:10px; color:red">Hooray!</span>
<img style="position:absolute; left:50px; top:2px"
src="images/broncos_header.gif" alt="Denver Broncos" />
</div>
z-index
values appear on top
<div style="position:relative; left:20px; top:0px; border:1px solid green;
height:80px; width:300px; z-index:2">
<span style="position:absolute; left:10px; top:10px; z-index:2;
color:red">Hooray!</span>
<img style="position:absolute; left:50px; top:2px; z-index:1"
src="images/broncos_header.gif" alt="Denver Broncos">
</div>