zoukankan      html  css  js  c++  java
  • _#【清除浮动】

    CSS 清除浮动的4种方法

    更简洁的 CSS 清理浮动方式

    1、

    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            .box {
                background-color: #FF0;
            }
            .box-bd {
                display: inline;
                float: left;
                width: 100px;
                height: 100px;
                margin-right: 100px;
                background-color: #F00;
            }
            .clear {
                clear: both;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <div class="box-bd"></div>
            <div class="clear"></div>
        </div>
        2
    </body>
    </html>

    2、

    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            .box {
                background-color: #FF0;
            }
            .box-bd {
                display: inline;
                float: left;
                width: 100px;
                height: 100px;
                margin-right:100px;
                background-color: #F00;
            }
            .box {
                float: left;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <div class="box-bd"></div>
        </div>
        2
    </body>
    </html>

    3、

    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            .box {
                background-color: #FF0;
            }
            .box-bd {
                display: inline;
                float: left;
                width: 100px;
                height: 100px;
                margin-right: 100px;
                background-color: #F00;
            }
            .box {
                width: 100%;
                overflow: hidden;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <div class="box-bd"></div>
        </div>
        2
    </body>
    </html>

    4、

    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            .box {
                background-color: #FF0;
            }
            .box-bd {
                display: inline;
                float: left;
                width: 100px;
                height: 100px;
                margin-right: 100px;
                background-color: #F00;
            }
            .clearfix:after {
                visibility: hidden;
                display: block;
                font-size: 0;
                content: " ";
                clear: both;
                height: 0;
            }
            .clearfix {
                zoom: 1;
            }
        </style>
    </head>
    <body>
        <div class="box clearfix">
            <div class="box-bd"></div>
        </div>
        2
    </body>
    </html>

    5、

    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            .box {
                background-color: #FF0;
            }
            .box-bd {
                display: inline;
                float: left;
                width: 100px;
                height: 100px;
                margin-right: 100px;
                background-color: #F00;
            }
            .cf:before,
            .cf:after {
                content: "";
                display: table;
            }
            .cf:after {
                clear: both;
            }
            .cf {
                zoom: 1;
            }
        </style>
    </head>
    <body>
        <div class="box cf">
            <div class="box-bd"></div>
        </div>
        2
    </body>
    </html>
  • 相关阅读:
    hdu 3648 Median Filter (树状数组)
    poj 1470 Closest Common Ancestors (LCA)
    poj 1330 Nearest Common Ancestors (LCA)
    hdu 2586 How far away ? (LCA)
    poj 3253 Fence Repair (哈夫曼)
    poj 1094 Sorting It All Out (拓扑排序)
    hdu 2527 Safe Or Unsafe (哈夫曼树)
    三层架构
    SQL2008、SQL2013 执行Transact-SQL 语句或者批处理时发生了异常。错误5120
    【MediaKit】WPF项目中 调用摄像头拍照的开发包
  • 原文地址:https://www.cnblogs.com/jzm17173/p/2606923.html
Copyright © 2011-2022 走看看