清晰的属性

clear 属性与浮动直接相关。属性价值:

  • 无 - 默认。允许两侧浮动元素
  • left - 左侧不允许浮动元素
  • 对 - 右侧不允许浮动元素
  • 两者 - 左侧或右侧不允许浮动元素
  • initial - 将此属性设置为其默认值。阅读初始内容
  • inherit - 从其父元素继承此属性。阅读有关继承的信息
<html>
<head>
<style>
img {
    float: left;
}

p.clear {
    clear: both;
}
</style>
</head>
<body>

<img src="https://static.pexels.com/photos/69372/pexels-photo-69372-medium.jpeg" width="100">
<p>Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum </p>
<p class="clear">Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum Lorem ipsoum </p>

</body>
</html>