Style clear property

Definition and usage

clear The property sets or returns the position of the element relative to floating objects.

clear The property specifies which side of the element does not allow other floating elements.

See also:

CSS Tutorial:CSS floating

CSS Reference Manual:clear property

Instance

Example 1

Prohibit floating objects on the left side of the text in the <p> element:

document.getElementById("myP").style.clear = "left";

Try it yourself

Example 2

Return clear property:

alert(document.getElementById("myP").style.clear);

Try it yourself

Syntax

Return clear property:

object.style.clear

Set clear property:

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 property to its default value. See initial
inherit This property is inherited from its parent element. See inherit

Technical details

Default value: None
Return value: A string indicating 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