005-CSS让页脚始终在底部不论页面内容多少
让页脚始终在页面底部,不论页面内容是多或者少页脚始终在页面底部。
方案一:
<!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让页脚始终在底部不论页面内容多少的更多相关文章
- CSS + DIV 让页脚始终底部
一 前言 经常设计页面时用到三层DIV,头DIV与脚DIV一般固定高度,而中间层DIV根据内容的多少,高度不定,我们经常希望但内容很少时,脚DIV保持在底部,当内容很多时,脚DIV被中间内容挤到下面, ...
- CSS + DIV 让页脚始终保持在页面底部
来源:David's Blog http://www.DavidQiu.com/ 文章链接:http://blog.davidqiu.com/post/2013-06-17/400517539 ...
- 网页布局中页面内容不足一屏时页脚footer固定底部
方法一:给html.body都设置100%的高度,确定body下内容设置min-height有效,然后设置主体部分min-height为100%,此时若没有header.footer则刚好完美占满全屏 ...
- html页脚固定在底部的方法
<style type="text/css"> html { height: 100%; } body { height: 100%; margin: 0; paddi ...
- 让页脚footer永远固定在页面的底部,而不是永远固定在显示器屏幕的底部的方法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 【CSS】使用浮动来创建拥有页眉、页脚、左侧目录和主体内容的首页
有两种创建水平导航栏的方法.使用行内或浮动列表项. 如果您希望链接拥有相同的尺寸,就必须使用浮动方法. 1.构建水平导航栏的方法之一是将 <li> 元素规定为行内元素: display:i ...
- 【转载自W3CPLUS】如何将页脚固定在页面底部
该文章转载自:W3CPLUS 大漠的文章 http://www.w3cplus.com/css/css-sticky-foot-at-bottom-of-the-page 以下为全文 作为一个Web的 ...
- 将HTML页面页脚固定在页面底部(多种方法实现)
当一个HTML页面中含有较少的内容时,Web页面的footer部分随着飘上来,处在页面的半腰中间,给视觉效果带来极大的影响,接下来为大家介绍下如何将页脚固定在页面底部,感兴趣的朋友可以了解下 作为一个 ...
- 如何将页脚固定在页面底部,4中方法 转载自:W3CPLUS
原博客地址:http://www.w3cplus.com/css/css-sticky-foot-at-bottom-of-the-page 作为一个Web的前端攻城师,在制作页面效果时肯定有碰到下面 ...
随机推荐
- C#订阅与发布标准实现
大概看了下C#官方提供的IObservable接口以及IObserver接口来实现发布和订阅,写的很标准,很有代表性,做下笔记,以后要是项目需要用到发布订阅再基于自己的需求改: public clas ...
- pandas 必背函数操作
1.五个常用属性 index,columns,shape,values,dtypes2.常用函数:set_index,reset_index,del df['column_name'],pd.read ...
- struts2的java.lang.NoSuchMethodException错误
不久前在学习struts时出现这个错误,在网上搜索了半天,发现答案不一.将其总结如下,以方便大家参考. 1. 你有没有试试看 其它的方法能不能用,要是都是这种情况的话,可能是你的Action类没有继承 ...
- 13树莓派手动安装Home Assistant
2017-09-05 00:53:02 https://home-assistant.io/docs/installation/raspberry-pi/ 已经安装步骤安装了带桌面的树莓派系统,在SD ...
- angularjs ng-if 中的ng-model 值作用域问题
现象:最近做了一个需求,页面上使用了ng-if 条件做判断,导致通过使用 $scope 获取不到 ng-model 的值. 问题原因: ng-if这个指令单独开了一个作用域,它只可以继承,不可以进行往 ...
- bootstrap_响应式布局简介_媒体查询_媒体选择器_2x3x图
响应式布局 在不同设备上,同一网页根据设备特性(显示屏大小,分辨率)呈现不同的布局样式. 思考: 获取设备相关信息 将屏幕划分为几个区域 给需要变化的结构写多套 css 样式 媒体查询 常用写法 @m ...
- opencv 常用头文件介绍
1.OpenCV包含的模块 cv – 核心函数库 cvaux – 辅助函数库 cxcore – 数据结构与线性代数库 highgui – GUI函数库 ml – 机器学习函数库 2.常用头文件: #i ...
- Mac 比较实用的软件
解压缩 BetterZip 系统 CleanMyMac Quicksilver Alfred3 视频 Movist
- centos下设置nodejs开机启动
node环境的安装便不再赘述了,网上有很多教程,也非常简单. 上一篇博客介绍了用nginx代理nodejs.这一篇是使用pm2实现nodejs的自动重启. 什么是pm2? 如官网介绍的,pm2是nod ...
- v-for同时循环一个对象和数组
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...