让页脚始终在页面底部,不论页面内容是多或者少页脚始终在页面底部。

方案一:

 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
body, html {
margin: 0;
padding: 0;
height: 100%;
} #main {
position: relative;
min-height: 100%;
background: #eee;
} #content {
padding: 10px;
padding-bottom: 100px;
} #footer {
position: absolute;
bottom: 0;
height: 100px;
width: 100%;
background: lightblue;
}
</style>
</head>
<body>
<div id="main">
<div id="content">
<script type="text/javascript">
for (var i = 0; i < 400; i++) {
document.write(i + '<br/>');
}
</script>
</div>
<div id="footer">
Footer
</div>
</div>
</body>
</html>

方案二:

 <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>css实现页脚始终在最底部</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
} html {
*overflow: auto;
} body {
_width: expression(this.parentNode.clientWidth);
} html, body {
height: 100%;
} .section {
min-height: 100%;
_height: 100%;
} .footer {
height: 60px;
background: #000;
margin-top: -60px;
color: #FFF;
}
</style>
</head>
<body>
<div class="section">
<script type="text/javascript">
for (var i = 0; i < 400; i++) {
document.write(i + '<br/>');
}
</script>
</div>
<div class="footer">我是页脚</div>
</body>
</html>

让页脚始终固定在屏幕底部:

 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title></title>
<meta name="generator" content="editplus">
<meta name="author" content="Ariex">
<meta name="keywords" content="">
<meta name="description" content="">
<style type="text/css">
body {
margin: 0px;
padding: 0px;
overflow: hidden;
padding-top: 22px;
padding-bottom: 22px;
} #header {
background-color: blue;
color: white;
position: absolute;
top: 0px;
left: 0px;
height: 16px;
width: 100%;
} #content {
background-color: yellow;
width: 100%;
height: 100%;
overflow: auto;
} #footer {
background-color: green;
color: white;
width: 100%;
height: 16px;
position: absolute;
bottom: 0px;
left: 0px;
}
</style>
<script language="javascript">
</script>
</head>
<body>
<div id="header">header</div>
<div id="content">
<script language="javascript">
for (i = 0; i < 1000; i++) {
document.write(i + "");
}
</script>
</div>
<div id="footer">footer</div>
</body>
</html>

005-CSS让页脚始终在底部不论页面内容多少的更多相关文章

  1. CSS + DIV 让页脚始终底部

    一 前言 经常设计页面时用到三层DIV,头DIV与脚DIV一般固定高度,而中间层DIV根据内容的多少,高度不定,我们经常希望但内容很少时,脚DIV保持在底部,当内容很多时,脚DIV被中间内容挤到下面, ...

  2. CSS + DIV 让页脚始终保持在页面底部

    来源:David's Blog     http://www.DavidQiu.com/ 文章链接:http://blog.davidqiu.com/post/2013-06-17/400517539 ...

  3. 网页布局中页面内容不足一屏时页脚footer固定底部

    方法一:给html.body都设置100%的高度,确定body下内容设置min-height有效,然后设置主体部分min-height为100%,此时若没有header.footer则刚好完美占满全屏 ...

  4. html页脚固定在底部的方法

    <style type="text/css"> html { height: 100%; } body { height: 100%; margin: 0; paddi ...

  5. 让页脚footer永远固定在页面的底部,而不是永远固定在显示器屏幕的底部的方法

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. 【CSS】使用浮动来创建拥有页眉、页脚、左侧目录和主体内容的首页

    有两种创建水平导航栏的方法.使用行内或浮动列表项. 如果您希望链接拥有相同的尺寸,就必须使用浮动方法. 1.构建水平导航栏的方法之一是将 <li> 元素规定为行内元素: display:i ...

  7. 【转载自W3CPLUS】如何将页脚固定在页面底部

    该文章转载自:W3CPLUS 大漠的文章 http://www.w3cplus.com/css/css-sticky-foot-at-bottom-of-the-page 以下为全文 作为一个Web的 ...

  8. 将HTML页面页脚固定在页面底部(多种方法实现)

    当一个HTML页面中含有较少的内容时,Web页面的footer部分随着飘上来,处在页面的半腰中间,给视觉效果带来极大的影响,接下来为大家介绍下如何将页脚固定在页面底部,感兴趣的朋友可以了解下 作为一个 ...

  9. 如何将页脚固定在页面底部,4中方法 转载自:W3CPLUS

    原博客地址:http://www.w3cplus.com/css/css-sticky-foot-at-bottom-of-the-page 作为一个Web的前端攻城师,在制作页面效果时肯定有碰到下面 ...

随机推荐

  1. Hexo主题yilia增加gitalk评论插件

    虽然gitment可以实现评论功能,但是适配方面做的并不好,这里借用GitHub上的gitalk项目用来优化个人博客的评论功能 下面记录自己从gitment到gitalk的替换过程: 1.在layou ...

  2. 编译linux内核前用make menuconfig设置时 Unable to find the ncurses ibraries的解决办法

    今天在更新CentOS或者Ubuntu的内核时,执行make menuconfig可能看如这样的错误: *** Unable to find the ncurses libraries or the ...

  3. NOIP-机器翻译

    题目描述 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件会先在内存中查 ...

  4. angular.isDate()

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. Android第四次作业

    一.团队成员 成员1:刘宇莹 学号:1600802122 班级:计算机164 博客链接:刘宇莹 成员2:孟鑫菲 学号:1600802092 班级:计算机163 博客链接:孟鑫菲 二.团队项目apk 拍 ...

  6. AWS Nginx Started but not Serving AWS上Nginx服务器无法正常工作

    After install the Nginx on AWS instance, and visit your public ip address, you might see the followi ...

  7. mysql字符集校对

    常用的两种 utf8_general_ci 按照普通的字母顺序,而且不区分大小写(比如:a B c D)utf8_bin 按照二进制排序(比如:A排在a前面,B D a c) ci是 case ins ...

  8. 【zc】 PHP中json_encode(编码) 与 json_decode(解码) 【aa】

    一.json_encode() 对变量进行JSON编码, 语法: json_encode ( $value [, $options = 0 ] ) 注意:1.$value为要编码的值,且该函数只对UT ...

  9. 梦里寻她千百度,Bug却在隔壁老张处

    程序员与 Bug 是一对矛盾的存在,程序员既要在解决 Bug 中获得成就感,同时也讨厌 Bug 本身的存在.“程序不息,Bug 不止”,程序员在与 Bug 的斗争中,也有很多有趣的事情发生,我们整理了 ...

  10. Ehcache 3.7文档—基础篇—JCache aka JSR-107

    一. 概述JCache Java临时缓存API(JSR-107),也被称为JCache,它是一个规范在javax.cache.API中定义的.该规范是在Java Community Process下开 ...