鍍金池/ 問答/HTML/ 去浮動問題:為什么下面的代碼clearfix不能去浮動

去浮動問題:為什么下面的代碼clearfix不能去浮動

去浮動問題被搞了好久網上查了感覺好亂,為什么下面的代碼clearfix不能去浮動,有沒有大佬解釋一下

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>lianxi</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
        .clearfix :after {
            content: '';
            display: table;
            clear: both

        }
/*        .clearfix:after { 
            content:"\200B"; 
            display:block; 
            height:0; 
            clear:both; 
        } 
        .clearfix{*zoom:1;}/*IE/7/6*/*/
        .div1{
            width: 50px;
            height: 50px;
            background: red;
            float: left;
        }
        .div2{
            width: 200px;
            height: 50px;
            background: blue;
        }
    </style>
</head>
<body>
    <div class="clearfix">
        <div class="div1">16</div>
        <!-- <p style="clear: both;"></p> -->
        <div class="div2">20</div>
    </div>
    
</body>
<script>

</script>
</html>
回答
編輯回答
妖妖

你把 /*/*IE/7/6*/*/ 去掉就好了。。。
細心、格式、、、、

2017年12月27日 09:43