HTML CSS examples for CSS Widget:Header
Fixed header, page scrolls into header
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> header {<!-- www . jav a2 s . c o m--> height: 50px; position:fixed; top:0px; left:0px; z-index:4; background-color:orange; } .page { margin-top:40px; } .main { float: right; width: 740px; } footer { position: fixed; bottom: 0px; height: 50px; background-color:orange; z-index:4; } </style> </head> <body> <header> This content should stay on top. </header> <div class="page"> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="sidebar"> test </div> <div class="main"></div> </div> <div style="clear:both"> <footer> This content should stay on bottom. </footer> </div> </body> </html>