• 伪选择器:after的清浮动简单效果


    :after的作用是在当前的应用元素后面添加内容

    如div:after{

      content:"This is a demo"

    }

    还有就是清除浮动(参考代码):

    <style>
        #box{border:2px solid #ccc;}
        .clear:after{content:'';display:block;clear:both;}
        .box{width:200px;height:100px;background:red;float:left;}
    </style>
    </head>
    
    <body>
        <div id="box">
            <div class="box"></div>
            <div class="clear"></div>
        </div>
    </body>
  • 相关阅读:
    053403
    053402
    053401
    053400
    053399
    053398
    053397
    053396
    053395
    第k小数
  • 原文地址:https://www.cnblogs.com/hellome/p/3924318.html
Copyright © 2020-2023  润新知