解决方案:给子元素一个after伪类,清除浮动code
:after{ content:""; clear:both;/\*清除浮动\*/ display:block;/\*确保该元素是一个块级元素\*/ }