清晰的屬性

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>