CSS清除属性
示例
clear属性与浮点数直接相关。属性值:
无-默认。允许两侧都浮动
左侧-左侧不允许有浮动元素
右侧-右侧不允许有浮动元素
两者-左侧或右侧均不允许使用浮动元素
initial-将此属性设置为其默认值。阅读有关初始
继承-从其父元素继承此属性。了解有关继承的信息
<html> <head> <style> img { float: left; } p.clear { clear: both; } </style> </head> <body> <img xx_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>