How do I clear my floats?

前端 未结 4 573
甜味超标
甜味超标 2021-01-23 08:08



        
相关标签:
4条回答
  • 2021-01-23 08:26

    add overflow:auto for .content to clear the floats

    example: http://jsbin.com/onedi3

    More information for clearing you can find at http://www.quirksmode.org/css/clearing.html

    0 讨论(0)
  • 2021-01-23 08:33

    Adding overflow: hidden; to your .content {} will sort this out. It's a float clearing thing. Adding overflow or a clearing element will make the wrapper contain what's inside.

    0 讨论(0)
  • 2021-01-23 08:42

    Floating elements are "removed" from their parent, layout-wise. So your content div is empty and gets a height of 0. See this css-discuss article for the causes and fixes.

    0 讨论(0)
  • 2021-01-23 08:44

    With XHTML the div has to have content or it will not be registered as "there." To force it to display using XHTML, type   in the div you wish to display.

    0 讨论(0)
提交回复
热议问题