search

Home  >  Q&A  >  body text

html5 - 关于img标签 左浮动的问题

请问一下 为什么img标签加上左浮动之后 它原本在下面的东西就能跑到img的右边去呢?

我记得p1和p2,假如把p1加上左浮动的时候,那这时不是应该是p1覆盖了一部分p2的吗?求高手解答一下 谢谢!

这和标签什么默认属性有关系的吗 ?

高洛峰高洛峰2784 days ago914

reply all(4)I'll reply

  • 黄舟

    黄舟2017-04-17 14:33:31

    MDN Documentation

    W3C Document

    Maybe float was originally set to achieve text wrapping effect

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 14:33:31

    Text elements and inline elements will be placed around floating elements, while block-level elements will fill the gaps before floating elements. I don’t know the specific reason why

    reply
    0
  • 阿神

    阿神2017-04-17 14:33:31

    Add overflow:hidden;

    to the outer parent element

    reply
    0
  • 迷茫

    迷茫2017-04-17 14:33:31

    Two block elements are arranged from top to bottom. One floats to the left and the other naturally floats over

    reply
    0
  • Cancelreply