Home >Web Front-end >HTML Tutorial >How to place the footer tag at the bottom of the page
This time I will show you how to place the footer tag at the bottom of the page. What are the precautions? Here are the actual cases, let's take a look.
<!-- 父层 --> <div id="wapper"> <!-- 主要内容 --> <div id="main-content"> </div> <!-- 页脚 --> <div id="footer"> </div> </div>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 processed separately:
<!--[if IE 6]-> <style> #wapper{height:100%;} /* IE在高度不够时会自动撑开层*/ </style> <![endif]-->I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website! Related reading:
How to make mobile web page content adaptive
How to deal with content overflow in the table table
What are the differences between iframe and frame in HTML
The above is the detailed content of How to place the footer tag at the bottom of the page. For more information, please follow other related articles on the PHP Chinese website!