CSS provides six positioning models for positioning an element
static can position inline, inline-block, block, and table elements. absolute and fixed can position any elements. float model can position float boxes. relative can position any type of box except for absolute boxes. relative- float can relatively position float boxes. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < html xmlns= "http://www.w3.org/1999/xhtml" > <head> <title></title> <style type= "text/css" > .section { position: fix; width: 600 px; height: 600 px; background: gray; } * .centered { width: 380 px; margin-left: auto; margin-right: auto; background: red; } * . static { position: static ; background: blue; } * .absolute { position: absolute; top: 20 px; left: 215 px; background: yellow } * .fixed { position: fixed; bottom: 20 px; right: 5 px; background: gold; } * .relative { position: relative; top: 20 px; left: 30 px; background: black; } * . float { float : right; background:pink; } </style> </head> < body > <div class = "section" > <p class = "static centered" > <span class = "static centered" >Static</span> <span class = "absolute" >Absolute</span> <span class = "fixed" >Fixed</span> <span class = "relative" >Relative</span> <span class = "float" >Float</span> <span class = "relative float" >Relative Float</span> </p> </div> </ body > </ html >
HTML code for linking to this page:
Related in same category :