CSS: DIV containing no height on float set

后端 未结 4 1600
感动是毒
感动是毒 2020-12-02 23:34

assume we have this code:

4条回答
  •  北海茫月
    2020-12-03 00:30

    This is intentional as floats are designed for things like images in paragraphs (where multiple paragraphs can wrap around the image).

    Complex Spiral has a fuller explanation as to why and Ed Elliot describes a number of approaches to making containers expand around floats. I find the overflow: hidden approach works best in most situations.

提交回复
热议问题