We would like to know how to fixed header to top.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
root {<!-- w ww. ja v a 2 s .c o m-->
display: block;
}
body {
position: relative;
}
header, footer {
position: fixed;
width: 100%;
background-color: black;
}
header {
top: 0;
height: 50px;
}
footer {
bottom: 0;
height: 100px;
}
section {
position: relative;
width: 100%;
height: 1400px;
}
</style>
</head>
<body>
<header></header>
<section></section>
<footer></footer>
</body>
</html>
The code above is rendered as follows: