Six ways to clear floats in CSS

高洛峰
Release: 2017-03-15 11:05:16
Original
1590 people have browsed it

html

    <p>
        <p class=&#39;box-left&#39;></p>
        <p class=&#39;box-right&#39;></p>
    </p>
Copy after login

css

    .box-left,.box-right{
        width:200px;
        height:200px;        float: left;
        background: red;
        border:1px solid #333;
    }
Copy after login

The first method: .box{clear:box}

th The second method: .box{overflow:hidden}

The third method: .box{overflow:auto}

The fourth method: .box:after{ content:""; height:0; visibility:hidden; display:block; clear:both;}.box{ zoom:1 ;}

The fifth method: .box{height:200px} sets the height

The sixth method: .box{display:table}

Any other methods are welcome to add, come on, let’s make progress together

The above is the detailed content of Six ways to clear floats in CSS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!