其他分享
首页 > 其他分享> > 清浮动 css

清浮动 css

作者:互联网


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .left {
            float: left;
            background-color: #f00;
            width: 300px;
            height: 300px;
            margin-left: -100%;
        }

        .mian {
            width: 100%;
            float: left;
            background-color: #0f0;
            height: 300px;

        }




        .mian-box {
            float: left;
            margin: 0 300px;

        }

        .right {
            float: right;
            background-color: #00f;
            width: 300px;
            height: 300px;
            margin-left: -300px;
        }

        .clearfix:after {
            /*伪元素是行内元素 正常浏览器清除浮动方法*/
            content: "";
            display: block;
            height: 0;
            clear: both;
            visibility: hidden;
        }

        .clearfix {
            *zoom: 1;
            /*ie6清除浮动的方式 *号只有IE6-IE7执行,其他浏览器不执行*/
        }

        .food {
            /* width: 100%;
            background-color: #ff0; */
            border: 2px skyblue solid;
            height: 100px;
            width: 100px
        }
    </style>
</head>

<body><script id="__bs_script__">//<![CDATA[
    document.write("<script async src='/browser-sync/browser-sync-client.js?v=2.26.7'><\/script>".replace("HOST", location.hostname));
//]]></script>

    <div class="clearfix">
        <div class="mian ">
            <div class="mian-box">
                我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁我是谁
            </div>
        </div>
        <div class="left">left</div>
        <div class="right">right</div>
    </div>

    <div class="food">food</div>
</body>

</html>

标签:浮动,color,float,300px,height,width,css,left
来源: https://blog.csdn.net/qq_42374676/article/details/122001108