Style clear attribute
- Previous Page caretColor
- Next Page clip
- Go to Parent Level HTML DOM Style Object
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 Floating
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 the clear attribute:
alert(document.getElementById("myP").style.clear);
Syntax
Return the clear attribute:
object.style.clear
Set the 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 | Sets this attribute to its default value. See initial. |
inherit | This attribute is inherited from its parent element. See inherit. |
Technical details
Default value: | None |
---|---|
Return value: | A string representing the position of the element relative to the floating object. |
CSS Version: | CSS1 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page caretColor
- Next Page clip
- Go to Parent Level HTML DOM Style Object