2605/090
CSS-Two “Sticky Footer” Pure-CSS Solutions
如题,今天讲的是固底DIV的纯CSS解决方案,啊,或者说解决方法比较合适?
找了下资料,目前有2个比较可靠而且兼容性较好的解决方案,一个是CSS Sticky Footer,因为有中文版,大家自己看吧。
第2个是Ryanfait的《Make the Footer Stick to the Bottom of a Page》。
两者相差不大,最多就是CSS Sticky Footer少了一个DIV,且兼容的浏览器更多。
来,看一下《Make the Footer Stick to the Bottom of a Page》 的HTML代码:
<div class="wrapper"> <p>Your website content here.</p> <div class="push"></div> </div> <div class="footer"> <p>Copyright (c) 2008</p> </div>
这里的DIV->push就是多出来的那个DIV~引用CSS Sticky Footer的话说就是:
Some HTML purists may find this a blasphemous use of non-semantic code. Our solution avoids the extra
对照的中文翻译是:
对HTML语义要求严格的人可以说代码这么写是不符合规范的,我们的方案不用附加的DIV~
然后是CSS:
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
.footer, .push {
height: 4em;
}
这里同CSS Sticky Footer的做法是一样的,需要给.footer写一个height,并且在.wapper里写margin-bottom,height。
本人没有安装太多的浏览器测试,不过CSS Sticky Footer是号称兼容N多个浏览器,而Ryanfait的则是标了FF,IE,Opera,Safari。
Some Related Posts
- 2009/06/18 -- Flash-Transparent时在FF和Safari下无法输入中文的解决方案 (0)
- 2009/11/25 -- 记得关注你的竞争对手 (0)
- 2009/08/06 -- IE6 No More (2)
- 2008/12/15 -- IE6的absolute Bug (0)
- 2008/06/23 -- 关于HTML注释在IE,FF下的问题 (0)
- 2009/04/20 -- CSS Tools-Reset CSS (0)
- 2009/04/09 -- CSS Naked Day! (2)
- 2009/04/01 -- Flash-CSS,StyleSheet (0)
- 2008/08/06 -- Drupal模板页node.tpl.php/样式定制 (0)
- 2008/08/05 -- Drupal 模块webform介绍及建议 (0)
Tag: CSS, FF, Firefox, Html, IE, Opera, Safari, Sticky Footer
Leave a comment
听说你要找我?
- QQ:104357575
- Gmail:k5angle9527@gmail.com
Categories
- AIR+FB+AS3 (169)
- Android (28)
- Demo (78)
- fDEV (3)
- Flash AS2 (66)
- Game (22)
- iPhone (1)
- jQuery (14)
- Others (95)
- PHP (43)
- Wordpress (60)
Recent Comments
- Anonymous says under Discuz!验证码总是错误:wuwu :xizao :wuwu :wenhao :touxiang :shuaya ...
- Anonymous says under 有关Flash 8 Video Encoder无法启动的问题:chaocai :shengtian 高级感谢~~~我找了一个晚上了,嗨哭命呀! 不过幸好...
- DFdou says under AS3-留言板(GuestBook)更新@DFdou, :leilei 这样啊,thx 哦
- lightoy says under AS3-留言板(GuestBook)更新@DFdou, a...不要把amfphp里面的.htaccess文件上传即可~_!
- Anonymous says under Android-ListView用法:zhuang
- DFdou says under AS3-留言板(GuestBook)更新@Lightoy, amfphp和.htaccess不会有冲突啊
- DFdou says under GAME-NamePK 基于MD5的名字PK(上)@, 随意~~
- Anonymous says under jQuery-each(fn)的使用:loveu :leilei :kua
- Lightoy says under AS3-留言板(GuestBook)更新hi,你好,因为wordpress生成的.htaccess文件导致测试amfphp时产生了500 I...
- Anonymous says under GAME-NamePK 基于MD5的名字PK(上):shengtian 博主我可以弄走做个养成pk游戏么?
Blogroll
Archive
- August 2010 (3)
- July 2010 (3)
- June 2010 (3)
- May 2010 (4)
- April 2010 (4)
- March 2010 (8)
- February 2010 (13)
- January 2010 (9)
- December 2009 (19)
- November 2009 (23)
- October 2009 (17)
- September 2009 (22)
- August 2009 (13)
- July 2009 (20)
- June 2009 (18)
- May 2009 (18)
- April 2009 (29)
- March 2009 (31)
- February 2009 (46)
- January 2009 (37)
- December 2008 (16)
- November 2008 (12)
- October 2008 (21)
- September 2008 (10)
- August 2008 (12)
- July 2008 (14)
- June 2008 (8)
- May 2008 (11)