Browse By Name
HTMLCSSJavaScriptAppendix
You are here: Reference > JavaScript > client-side > HTML DOM > properties > clear (address, br, Hn, pre, ...)

clear property (address, br, Hn, pre, ...)

A A Font size Print Content Add new content Share Share
Browser support:
Specifies or returns the position of the element in relation to floating objects.
This property is deprecated. Use the clear style property instead.

Syntax:

object.clear;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: clear

Possible values:

String that sets or retrieves the position in relation to floating objects.
One of the following values:
all
The element will be placed below any floating objects.
left
The element be placed below any floating objects on the left side.
none
Allows floating content on all sides.
right
The element will be placed below any floating objects on the right side.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the clear attribute:
<img src="picture.gif" align="right" />
<h3 clear="right">This text should be placed below the image.</h3>

<br/><br/><br/>

<img src="picture.gif" align="right" />
<h3 clear="left">This text should be placed on the left side of the image.</h3>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the clear property:
<head>
    <script>
        function ChangeBehavior (elem) {
            var br = document.getElementById ("clearTest");

            // Returns the index of the selected option
            var whichSelected = elem.selectedIndex;

            // Returns the text of the selected option
            var scrollType = elem.options[whichSelected].text;

            br.clear = scrollType;
        }
    </script>
</head>
<body>
    <img src="picture.gif" align="left" />
    <h3 id="clearTest" clear="all">Element with clear attribute.</h3>

    <br /><br />
    Change the value of the clear attribute
    <div align="center">
        <select onClick="ChangeBehavior (this);" size="4">
            <option selected="selected" />all
            <option />left
            <option />right
            <option />none
        </select>
    </div>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content