


A simple way to implement the html footer at the bottom of the page
Requirements: Sometimes, when the page content is short and cannot support the height of the browser, but you want the footer to be at the lowest end of the window.
Idea: The minimum height of the footer's parent layer is 100%, and the footer is set to be absolutely bottomed (bottom: 0) relative to the position of the parent layer. , the height of the footer must be reserved in the parent layer.
html code:
<!-- 父层 --> <p id="wapper"> <!-- 主要内容 --> <p id="main-content"> </p> <!-- 页脚 --> <p id="footer"> </p> </p>
CSS is as follows:
#wapper{ position: relative; /*重要!保证footer是相对于wapper位置绝对*/ height: auto; /* 保证页面能撑开浏览器高度时显示正常*/ min-height: 100% /* IE6不支持,IE6要单独配置*/ } #footer{ position: absolute; bottombottom: 0; /* 关键 */ left:0; /* IE下一定要记得 */ height: 60px; /* footer的高度一定要是固定值*/ } #main-content{ padding-bottom: 60px; /*重要!给footer预留的空间*/ }
At this time, other browsers can display normally , but IE 6 needs to be dealt with separately:
<!--[if IE 6]-> <style> #wapper{height:100%;} /* IE在高度不够时会自动撑开层*/ </style> <![endif]-->
The above simple implementation method of placing the html footer at the bottom of the page is all the content shared by the editor. I hope it can help It is a reference for everyone, and I hope everyone will support the PHP Chinese website.
For more related articles on the simple implementation method of placing the html footer at the bottom of the page, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.
