ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## clear 属性 ### 属性定义及使用说明 clear属性指定段落的左侧或右侧不允许浮动的元素。 JavaScript 语法:object.style.clear="left" * * * ## 属性值 | 值 | 描述 | | --- | --- | | left | 在左侧不允许浮动元素。 | | right | 在右侧不允许浮动元素。 | | both | 在左右两侧均不允许浮动元素。 | | none | 默认值。允许浮动元素出现在两侧。 | | inherit | 规定应该从父元素继承 clear 属性的值。 | * * * ## 实例--指定段落的左侧或右侧不允许浮动的元素: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> img { float:left; } p.clear { clear:both; } </style> </head> <body> <img src="/attachments/cover/cover_css.png" width="95" height="84" /> <p>This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.</p> <p class="clear">This is also some text. This is also some text. This is also some text. This is also some text. This is also some text. This is also some text.</p> </body> </html> ```