zoukankan      html  css  js  c++  java
  • 使用clearfix样式来清除浮动

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
        <!--
        /**
         * Created by JetBrains WebStorm.
         * User: Ganler
         * Date: 13-5-29
         * Time: 下午10:31
         * To change this template use File | Settings | File Templates.
         */
         -->
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
        <style type="text/css">
            .clearfix {
                *zoom: 1;
            }
    
            .clearfix:before,
            .clearfix:after {
                display: table;
                line-height: 0;
                content: "";
            }
    
            .clearfix:after {
                clear: both;
            }
        </style>
    </head>
    <body>
    <div style="border:2px solid red;">
        没有clear的效果
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">CSSBBS</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
    </div>
    <div style="border:2px solid red;margin-top: 100px;">
       clear:both
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">CSSBBS</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="clear:both;"></div>
    </div>
    <div style="border:2px solid red;margin-top:100px;" class="clearfix">
     父容器使用 clearfix
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">CSSBBS</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="clear:both;"></div>
    </div>
    </body>
    </html>
  • 相关阅读:
    solr两种启动方式
    Centos7安装Solr
    关于netcore webservice 构建和参数大小控制问题
    百度开源ocr安装(飞浆)
    C# netcore 开发WebService(Soap)
    Aspose.CAD库简介 CAD转换PDF
    .net或JAVAK开发如何实现上传文件夹功能
    【转】TCP和SOCKET关系
    Asp.Net 绑定下拉框的值
    Windwos服务器远程桌面突然不能复制粘贴
  • 原文地址:https://www.cnblogs.com/ganler1988/p/3107187.html
Copyright © 2011-2022 走看看