CSS-设置Footer始终在页面底部_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:32:47
Original
1058 people have browsed it

Footer顾名思义页脚,如果内容多的时候在底部时感官很好,但是当内容变少(无法撑开一屏的时候)footer不固定在底部,影响美观,对于已经从事前端工作的工作的来说应该是比价工作中入门级别的问题了,由于本人前端水平有限,耗费一点时间最后通过负边距实现了这个简单的功能,代码如下:

    <div class="wrapper">        <p>博客地址:http://www.cnblogs.com/xiaofeixiang/</p>        <div class="replace"></div>    </div>    <div class="footer">       博客园-FlyElephant    </div>
Copy after login

设置CSS:

    * {        margin: 0;    }        html,    body {        height: 100%;    }        .wrapper {        min-height: 100%;        height: 100%;        margin: 0 auto -202px;//通过负边距隐藏replace    }        .footer,    .replace {        height:200px;//设置高度一致    }        .footer {        border: 1px solid #6AC5AC;    }
Copy after login

 无论页面内容长短可以满足开发需求~

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!