What is the layout of Sticky footer?
Jun 24, 2017 pm 02:18 PMWhat is the layout of Sticky footer?
Most of the website pages we see will divide a page into a header block, a content block and a footer block. When the header block and content block have less content, Footers can be anchored to the bottom of the screen rather than following the flow of the document. When there is a lot of content on the page, the footer can automatically expand with the flow of the document and be displayed at the bottom of the page. This is the Sticky footer layout.
Illustration
When the content is small, the normal document flow effect is as follows
In normal document flow, when the page content is small, the footer part is not fixed at the bottom of the window. In this case, the Stickyfooter layout must be used.
The layout effect of Sticky footer is as shown below
This is in line with our expected effect, as you can see The application scenarios of sticky footer layout are still very wide.
Implementation method
Negative margin layout method
html code:
1 |
|
css code:
1 |
|
Note: The
padding-bottom
of thecontent
element, the height of thefooter
element and thefooter
elementmargin-top
The value must be consistent.
This negative margin layout method is the most compatible layout scheme. All major browsers are perfectly compatible and suitable for various scenarios. However, the prerequisite for using this method is that Know the height of the footer
element, and the structure is relatively complex.
flex layout method
html code:
1 |
|
css code:
1 |
|
This layout The method has a simple structure and a small amount of code, and is also a recommended layout method.
Summary
Sticky footer layout is a very common page layout form, and there are many ways to implement it. The above two methods are the most commonly used and can basically meet all application scenarios.
The above is the detailed content of What is the layout of Sticky footer?. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

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

Windows 11: The easy way to import and export start layouts

How to save desktop icon position layout in Windows 11

Guide to solving misalignment of WordPress web pages

Which computer should Geographic Information Science majors choose?

How to create a responsive carousel layout using HTML and CSS

Flexible application skills of position attribute in H5

Robot ETF (562500) may usher in a good layout opportunity because it has pulled back for 3 consecutive days!

Introducing the window arrangement method in win7
