手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >利用CSS使footer固定在页面底部的实例代码
利用CSS使footer固定在页面底部的实例代码
摘要:1.HTML基本结构XML/HTMLCode复制内容到剪贴板layoutheadofyourwebsite.Yourwebsiteconte...

1. HTML基本结构

XML/HTML Code复制内容到剪贴板 <!DOCTYPEhtml> <htmlxmlnshtmlxmlns="http://www.w3.org/1999/xhtml"> <headrunatheadrunat="server"> <title>layout</title> </head> <body> <divclassdivclass="header"> <h1>headofyourwebsite.</h1> </div> <divclassdivclass="wrapper"> <divclassdivclass="content"> <h2>Yourwebsitecontenthere.</h2> <scripttypescripttype="text/javascript"> for(vari=0;i<100;i++){ document.write(i+"<br/>"); } </script> </div> <divclassdivclass="clear"><></div> </div> <divclassdivclass="footer"> <div><h1> Copyright(c)2012</h1></div> </div> </body> </html>

2. CSS样式

CSS Code复制内容到剪贴板 <styletype="text/css"> *{ margin:0;/*把默认值都设为0*/ } html,body { height:100%; width:85%; margin:0auto;/*居中*/ } .header { height:100px; background-color:Fuchsia; } .wrapper { min-height:100%;/*IE6hack*/ height:auto!important;/*height优先级*/ height:100%; margin:0auto-4em;/*负值必须等于footer的高度*/ } .content { background-color:Silver; } .clear/*清除浮动*/ { height:4em;/*clear的height必须和footer的值样高*/ clear:both; } .footer { height:4em; background-color:Aqua; } </style>

以上这篇利用CSS使footer固定在页面底部的实例代码就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持查字典教程网。

【利用CSS使footer固定在页面底部的实例代码】相关文章:

利用CSS实现禁止双击选择页面内容的实例展示

巧用CSS来控制div自适应浏览器的高度

用CSS3编程模仿iPhone中的返回按钮

CSS定义标题的实例讲解

怎样用CSS实现大背景网页效果

用CSS实现简单的进度条

利用CSS同比例缩小图片技巧

IE6定义1px左右高度的容器示例代码

css div绝对定位与固定定位实例

CSS定义Radio单选项和Checkbox复选框样式有效代码

精品推荐
分类导航