How to make a sticky footer?
How to make a sticky footer
By using absolute, the footer and main Container are subject to where you
put them. If you use absolute and set the footer to the bottom, it will
just stick to the bottom of the viewport.
Example :
HTML Code:
<html>
<title>Sticky Footer</title>
<head></head>
<body>
<header>
</header>
<main>
</main>
<footer></footer>
</body>
</html>
Css Code:
body {
width: 100%;
height: 600px;
color:#fff;
}
footer {
width: 100%;
color: #333;
height: 60px;
position: absolute;
bottom: 0;
}
That way, the footer always has enough room and is set to the bottom.
Comments
Post a Comment