THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Style clear Property

Style Object Reference Style Object

Example

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

document.getElementById("myP").style.clear = "left";
Try it yourself »

Definition and Usage

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The clear property is supported in all major browsers.


Syntax

Return the clear property:

object.style.clear

Set the clear property:

object.style.clear="none|left|right|both|initial|inherit"

Property Values

Value Description
none Allows floating objects on both sides of the element. This is default
left No floating objects allowed on the left side of the element
right No floating objects allowed on the right side of the element
both No floating objects allowed on either the left or right side of the element
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: none
Return Value: A String, representing the position of an element relative to floating objects
CSS Version CSS1

More Examples

Example

Return the clear property:

alert(document.getElementById("myP").style.clear);
Try it yourself »

Related Pages

CSS tutorial: CSS Float

CSS reference: clear property


Style Object Reference Style Object