CSS properties - clear

revision:


clear property

- controls the flow next to floated elements. It specifies what should happen with the element that is next to a floating element.

CSS syntax : clear: none | left | right | both | initial | inherit;

Property values:

none : default. The element is not pushed below left or right floated elements

left : the element is pushed below left floated elements

right : the element is pushed below right floated elements

both : the element is pushed below both left and right floated elements

initial : sets this property to its default value.

inherit : inherits this property from its parent element.

JavaScript syntax: object.style.clear="both"

example: clear

This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.

Remove the "clear" class to see the effect.

code:
                    <div>
                        <img src="../pics/smiley.png" width="150" height="150">
                        <p class="clear">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>
                        <p><strong>Remove the "clear" class to see the effect.</strong></p>
                    </div>
                    <style>
                        img {float: left;}
                        p.clear {clear: left;} 
                    </style>