Play Google

玩转谷歌--学习笔记,成长历程。

« 获取鼠标的坐标值(保证跨浏览器兼容)

清浮动

以前总是加一个<div sytle="clear:both"></div>来解决,但这样会增加无语义的标签,下面是用after伪类 实现,兼容多种浏览器。

/** 清浮动 **/
.clearfix:after{
    content:".";
    display:block;
    height:0;
    clear:both;
    visibility:hidden;
}

.clearfix{
    display:inline-block;
}

/* Hides from IE-mac \*/
* html .clearfix{
    height:1%;
}

.clearfix{
    display:block;
}
/* End hide from IE-mac */

  • 相关文章:
  • quote 1.新道
  • 恩,不错,这个办法还不错,
    但是好象一半设置overflow:auto;height:1%;
    就可以了.
    不用这么麻烦吧?
  • 2008-9-3 23:55:27 回复该留言

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

vinehoo,web2.0葡萄酒社区
vinehoo,web2.0葡萄酒社区

日历

最新评论及回复

最近发表

Powered By Karry 

Copyright © 2008 PlayGoogle.com. All Rights Reserved.