• 2019.12.04-清除浮动代码


    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>清除浮动</title>
    </head>
    <style type="text/css">
    .con,.con2{
    300px;
    border:1px solid #000;
    margin: 100px auto 0;
    font-size: 0;

    }

    .con a{
    50px;
    height: 50px;
    display:inline-block;
    background-color: gold;
    font-size: 16px;
    margin: 10px;
    text-align: center;
    line-height: 50px;
    text-decoration: none;
    }

    /* 第一种清除浮动
    .con2{
    overflow: hidden;
    }
    */

    .con2 a{
    50px;
    height: 50px;
    background-color: gold;
    font-size: 16px;
    margin: 10px;
    text-align: center;
    line-height: 50px;
    text-decoration: none;
    float: left;
    }

    /*
    .clearfix:before{
    content: "";
    display: table;
    }


    .clearfix:after{
    content: "";
    display: table;
    clear: both;
    }
    */
    .clearfix:before,.clearfix:after{
    content: "";
    display: table;
    }

    .clearfix:after{
    clear: both;
    }

    .clearfix{
    zoom:1;
    }

    .con3{
    300px;
    border:1px solid #000;
    margin: 100px auto 0;
    }

    .con3 span{
    background-color: gold;
    float: left;
    }

    </style>
    <body style="height: 2000px;">

    <div class="con">
    <a href="#">1</a>
    <a href="#">2</a>
    <a href="#">3</a>
    <a href="#">4</a>
    <a href="#">5</a>
    <a href="#">6</a>
    <a href="#">7</a>
    <a href="#">8</a>
    <a href="#">1</a>
    <a href="#">2</a>
    <a href="#">3</a>
    <a href="#">4</a>
    </div>

    <div class="con2 clearfix">
    <a href="#">1</a>
    <a href="#">2</a>
    <a href="#">3</a>
    <a href="#">4</a>
    <a href="#">5</a>
    <a href="#">6</a>
    <a href="#">7</a>
    <a href="#">8</a>
    <a href="#">1</a>
    <a href="#">2</a>
    <a href="#">3</a>
    <a href="#">4</a>
    <!-- <div style="clear: both"></div> 清楚浮动的第二种方法,不推荐 -->
    </div>

    <div class="con3 clearfix">
    <span>span元素</span>
    <span>span元素</span>
    <span>span元素</span>
    <span>span元素</span>
    <span>span元素</span>
    </div>

    </body>
    </html>

  • 相关阅读:
    利用KINECT+OPENCV检测手势的演示程序
    关于PPC软件的开发库
    FlashGet的IE加载项与IE8不兼容
    ubuntu9.04 安装字体 后记
    【pys60笔记】中文
    【pys60学习笔记】S60 模拟器使用。
    ubuntu9.04 安装字体
    IDE硬盘安装Windows 7 7106(光驱与硬盘共用一个IDE)
    易歌——web在线听歌桌面程序。带全局键控制。
    MapX直连Oracle——MapX5配合Oracle时,对中文表名支持不好
  • 原文地址:https://www.cnblogs.com/lishuide/p/11985969.html
Copyright © 2020-2023  润新知