zoukankan      html  css  js  c++  java
  • css清除浮动,清除浮动的几种方法

    2、清除浮动的方法:

    (1)使用clear:both。如果我们明确的知道紧接着浮动元素后面的元素,可以使用这种方法来清除浮动。这种方

             法简单,容易使用,不需要hack,语义化也不错。

    (2)空div方法。这个方法一般是不推荐使用的,虽然没有什么副作用的,但因为这个div纯粹是为了表现,没有语义。

    (3)自定义一个 cf 类,对容器添加 cf 类可以清除浮动

    .cf:before, .cf:after {
        content: '';
        display: block;
        clear: both;
        height: 0;
        overflow: hidden;
        visibility: hidden;
    }
  • 相关阅读:
    函数-列表生成式
    函数-闭包
    函数-参数
    函数-装饰器
    函数-函数递归
    函数-高阶函数
    函数-命名空间
    函数-匿名函数
    模块-shutil
    在 Android 5.1.1 执行 remount system failed 解决方法
  • 原文地址:https://www.cnblogs.com/cheer-up/p/7140626.html
Copyright © 2011-2022 走看看