Javascript examples for CSS Style Property:clear
The clear property sets or gets the position of the element relative to floating objects.
Value | Description |
---|---|
left | clear left floats. |
right | clear right floats. |
both | clear both left and right floats. |
auto | Doesn't clear any floated elements. This is default. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element clear property. |
Item | Value |
---|---|
Default Value: | none |
Return Value: | A String, representing the position of an element relative to floating objects |
CSS Version | CSS1 |
Get the clear value of a <p> element:
<!DOCTYPE html> <html> <body> <img style="float:left;" src="http://java2s.com/resources/c.png" width="100" height="132"> <p id="myP" style="clear:left;">This is some text. This is some text. This is some text. 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> <button type="button" onclick="myFunction()">Return the value of the clear property</button> <script> function myFunction() {/* ww w.j a va 2 s.com*/ console.log(document.getElementById("myP").style.clear); } </script> </body> </html>