zoukankan      html  css  js  c++  java
  • 清除浮动造成的影响的解决方案总结

    1、将设置float的元素的父元素也设置float。

      缺点:很有可能不符合情况要求

    2、设置父元素的position为absolute,前提是父元素的父元素并没有设置position:relative。

      缺点:很有可能不符合情况要求

    3、设置父元素的overflow为hidden。

      尚不知晓,猜测是只能清除浮动带来的父元素塌陷,但无法闭合浮动(待验证)

    4、设置父元素的display为inline-block。

      缺点:可能不符合情况要求。

    5、设置父元素的zoom为1。

      缺点:zoom为IE私有属性

    6、浮动元素的下方加入额外的元素<br style="clear:both;" />

      缺点:增加额外的标签使HTML结构看起来不够简洁

    7、使用after伪类(此方法目前应用较广)

    some:after{

      content:".";

      height:0;

      visibility:hidden;

      display:block;

      clear:both;

    }

  • 相关阅读:
    Codeforces Round #239(Div. 2) 做后扯淡玩
    hdu 3507 Print Article
    prufer序列
    POJ 2778 DNA Sequence
    Codeforces Round #237 (Div. 2)
    poj3352
    图论知识
    POJ 2186
    Codeforces Round #236 (Div. 2)
    POJ 2823 Sliding Window
  • 原文地址:https://www.cnblogs.com/charling/p/3360208.html
Copyright © 2011-2022 走看看