可以使用多种方法来清除浮动,其中一种常见的方法是使用带有 clear: both; 的空元素或者伪元素。,,``html,,,,,,清除浮动示例,, .container {, width: 100%;, background……
1. 使用 clear: both; 在容器的最后一个子元素之后添加一个空的div。,2. 使用伪元素 ::after,设置 content: ""; display: table; clear: both;。 CSS 完美清除浮动的两种解决方案: 1、使用 clearfix 伪元素 ……