Giter VIP home page Giter VIP logo

footer-at-the-bottom-of-page's Introduction

footer 固定在底部的若干方法

###两种情况:

  • 页面内容未填充满时,footer 固定在底部;
  • 页面填充满后,footer 随页面的增加填充在主体内容的下方

#####footer_1 [ 推拉推方法 ]:

html,body{
	height: 100%;
}
*{
	margin: 0;
	padding: 0;
}
.container{
	min-height: 100%;
}
.content{
	padding-bottom: 30px;
}
.footer{
	margin-top: -30px;
	height: 30px;
	background-color: #eee;
}
/*
创建一个足够大的容器container 包含整个网页

并将footer 挤到底端,通过设置 margin-top = -30px 使footer 上浮

并在content 中设置padding-bottom 使之能容下页脚而不重叠
*/

#####footer_2 [ flex 法 ]:

*{
	margin: 0;
	padding: 0;
}
body{
	display: flex;
	min-height: 100vh;
	flex-direction: column;
}
.content{
	flex: 1;
}

footer-at-the-bottom-of-page's People

Contributors

mondayc avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.