zoukankan      html  css  js  c++  java
  • 一个新的清楚浮动的方法

    /*大部分现代浏览器*/
    .cf:before,
    .cf:after {
        content: " ";
        display: table;
    }
    .cf:after {
        clear: both;
    }
    
    /*IE6&7(触发haslayout)*/
    .cf{
        *zoom: 1;
    }

    下面是一个测试的例子检查了所有的浏览器都完美的兼容了

    <!DOCTYPE html>
    <html xmlns=http://www.w3.org/1999/xhtml>
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <meta name="Keywords" content=""/>
        <meta name="Description" content=""/>
        <link type="text/css" href="normalize.css" rel="stylesheet" />
        <style type="text/css">
            .box{border: solid 2px red;}
            .rs{float: left;width: 200px;height: 400px;background: yellow;}
            .ls{float: right;width: 300px;height: 600px;background: pink;}
            .cf:after,.cf:before{content:' ';display: table;}
            .cf:after{clear:both;}
            .cf{*zoom:1;}
        </style>
    </head>
    <body>
        <div class="box cf">
            <div class="ls"></div>
            <div class="rs"></div>
        </div>
    </body>
    </html>
  • 相关阅读:
    vue Ant Design 树形控件拖动限制
    defineProperty介绍及使用
    webpack 配置入门
    vscode 插件
    解决输入框自动填充账号密码的问题
    css 动画
    vue按钮权限控制
    git操作
    TCP和UDP的区别
    通信协议 HTTP TCP UDP
  • 原文地址:https://www.cnblogs.com/BobSky/p/3108045.html
Copyright © 2011-2022 走看看