HTML CSS examples for CSS Layout:Position
properly position block elements vertically and horizontally
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> body,header,h1,ul { margin:0; color:Chartreuse; } header {<!-- w w w. ja v a2 s .c om--> background:yellow; border-bottom:3px solid blue; height:56px; } h1 { float:left; margin:.6em 0em 0em 2em; font:bold 3em arial; } ul { float:right; list-style:none; margin:2.6em 0em .6em; } ul li { float:right; } ul li a { font:bold 2.3em arial; color:pink; text-decoration:none; display:block; padding:.3em .5em; margin-left:.6em; } ul li a:hover { color:OrangeRed; border-color:grey; } </style> </head> <body> <header> <h1>Lorem ipsum dolor si</h1> <ul> <li> <a href="#">Lorem ip</a> </li> <li> <a href="#">Lorem ip</a> </li> <li> <a href="#">Lorem ip</a> </li> <li> <a href="#">Lorem ip</a> </li> </ul> </header> </body> </html>