Home  >  Article  >  Web Front-end  >  Footer position_html/css_WEB-ITnose

Footer position_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:08:181111browse

Sometimes the page content is not high enough, but you want the footer to be at the bottom of the page. I saw a good solution and would like to share it with you.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>    <style type="text/css">        *        {            margin: 0px;            padding: 0px;        }        html, body        {            height: 100%;        }    </style></head><body>    <div style="width: 100%; margin-bottom: -100px; background: #aa8; min-height: 100%;height: auto !important; height: 100%;">        <h1>Hello World</h1>        <div id="push" style="height: 100px;"></div>    </div>    <div id="footer" style="height: 100px; width: 100%; background: #fff;">        this is the footer    </div></body></html>


Reply to discussion (solution)

Original Css style

        /* sticky footer------------------------------*/* {	margin: 0;}html, body {	height: 100%;}	.wrapper {	min-height: 100%;	height: auto !important;	height: 100%;	margin: 0 auto -267px; /* the bottom margin is the negative value of the footer's height */}.footer, .push {	height: 267px; /* .push must be the same height as .footer */}

Support Share

Thank you for sharing

Sharing is glorious!

Support sharing!!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn