页面前台-用DIV+CSS让footer始终在底部
2012-02-21 22:17
549 查看
css如何定位网站的footer(用DIV+CSS让footer始终在底部)
平时拿CSS布局都是一些内容比较多的网站,前两天用CSS+DIV弄了个内容少的页面,发现了一个小问题,可能大家都会遇到,那就是网站FOOTER的定位,如果内容比较少的话,页面的FOOTER就会随着内容的减少跑到上面去,不是乖乖的在下面呆着,害得我研究了半天。
对于变量的内容,使得footer始终存在底部。并且整合了列表选项。使得页面排版更加工整。
一个典型的固定宽度的布局,该布局由顶部的一个标题,一个三列内容的区域(主内容列,每侧有一个工具条),和页面底部的一个页脚所组成。
--------------最后效果如下---------------------------------------
-----------以下是XHTML代码------------
-----------以下是CSS代码---------------------------
平时拿CSS布局都是一些内容比较多的网站,前两天用CSS+DIV弄了个内容少的页面,发现了一个小问题,可能大家都会遇到,那就是网站FOOTER的定位,如果内容比较少的话,页面的FOOTER就会随着内容的减少跑到上面去,不是乖乖的在下面呆着,害得我研究了半天。
对于变量的内容,使得footer始终存在底部。并且整合了列表选项。使得页面排版更加工整。
一个典型的固定宽度的布局,该布局由顶部的一个标题,一个三列内容的区域(主内容列,每侧有一个工具条),和页面底部的一个页脚所组成。
--------------最后效果如下---------------------------------------
-----------以下是XHTML代码------------
<body> <div id="content"> <div id="head"> <h1>hello</h1> </div> <div id="side1"> <h3>side1</h3> <ul> <li>Let me not to the marriage of true minds</li> <li>Admit impediments; love is not love</li> <li>Which alters when it alteration finds</li> <li>Or bends with the remover to remove</li> <li>Oh, no, it is an ever fixed mark</li> </ul> </div> <div id="main"> <h1>main</h1> <p>你可以改变浏览器窗口的高度,来观察footer效果。</p> <p>文字文字文字文字文字文字文字文字文字文字</p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <div id="side2"> <h3>side2</h3> <ul> <li>Let me not to the marriage of true minds</li> <li>Admit impediments; love is not love</li> <li>Which alters when it alteration finds</li> </ul> </div> <div id="footer"> <h1>Footer</h1> <div> </div> </body>
-----------以下是CSS代码---------------------------
body,html { margin: 0; padding: 0; font: 12px/1.5 arial; height:100%; } h1,h2,h3 { margin-top: 0px; padding-top: 0px; } #content { min-height:100%; height:auto; position: relative; } #head { position: absolute; left: 0px; top: 0px; width:750px; height:100px; background-color:#FF0 } div#side1 { position:absolute; width:150px; top: 100px; left:0px; background-color: #FF6666; } #main { padding-bottom: 60px; position: relative; left: 150px; top: 100px; width: 450px; margin: 0px; background-color: #999999; } div#side2 { position:absolute; width:150px; top: 100px; left: 600px; background-color: #00FF66; } #footer { position: absolute; bottom: 0; padding: 10px 0; background-color: #AAA; width: 100%; } #footer h1 { font: 20px/2 Arial; margin:0; padding:0 10px; } </style>
相关文章推荐
- 【转】DIV+CSS页面让footer始终在底部
- Css如何定位网站的footer在固定位置(用DIV+CSS让footer始终在底部)
- css让footer始终位于页面的最底部
- div footer标签css实现位于页面底部固定
- css让footer始终位于页面的最底部
- 如何css控制div始终在整个页面最底部
- CSS + DIV 让页脚始终保持在页面底部
- css实现让页面的footer始终位于底部
- CSS制作始终固定页面底部的DIV
- 【转】用DIV+CSS让footer始终在底部
- DIV+CSS让footer始终在底部
- CSS-设置Footer始终在页面底部
- 如何使页面的footer始终位于底部?
- 怎么让footer始终在页面底部?
- css让页脚始终在底部不论页面内容多少
- 页面主体高度不固定,如何让页面的footer始终在最底部
- CSS + DIV 让页脚始终底部
- 仅使用css,当body高度不足时,让footer始终底部显示。
- 纯css 实现footer 一直在页面底部,不随页面滚动
- DIV总显示在页面底部css