Style clear attribute
- 上一页 caretColor
- 下一页 clip
- 返回上一层 Object ng Style ng HTML DOM
Definition and usage
clear
This attribute sets or returns the position of the element relative to floating objects.
clear
This attribute specifies which side of the element does not allow other floating elements.
See also:
CSS Tutorial:CSS 浮动
CSS Reference Manual:clear attribute
Instance
Example 1
Prohibit floating objects on the left side of the text in the <p> element:
document.getElementById("myP").style.clear = "left";
Example 2
Return clear attribute:
alert(document.getElementById("myP").style.clear);
Syntax
Return clear attribute:
object.style.clear
Set clear attribute:
object.style.clear = "none|left|right|both|initial|inherit"
Attribute value
Value | Description |
---|---|
none | Floating objects are allowed on both sides of the element. Default. |
left | Floating objects are not allowed on the left side of the element. |
right | Floating objects are not allowed on the right side of the element. |
both | Floating objects are not allowed on the left or right side of the element. |
initial | Set this attribute to its default value. See initial。 |
inherit | This attribute inherits from its parent element. See inherit。 |
Technical details
Default value: | None |
---|---|
Return value: | 字符串,表示元素相对于浮动对象的位置。 |
CSS 版本: | CSS1 |
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |
- 上一页 caretColor
- 下一页 clip
- 返回上一层 Object ng Style ng HTML DOM