Export (0) Print
Expand All
top
Expand Minimize

clear

Sets whether the object allows floating objects on its left side, right side, or both, so that the text that follows is displayed below the floating objects.

Syntax

{ clear: sClear }

Possible values

sClear

String that specifies one of the following values:

none

Default. Floating objects are allowed on both sides.

both

Object is moved below any floating object.

left

Object is moved below any floating object on the left side.

right

Object is moved below any floating object on the right side.

This property has a default value of none. It is not inherited.

Remarks

The value of this property lists the sides where floating objects are not accepted.

Examples

The following example uses the clear property to specify placement of text relative to floating objects. This example uses a call to an embedded (global) style sheet to move the text below the floating objects when italic text is encountered:

<style>
    i { clear: left; }
</style>

This example changes the position of the paragraph relative to the floating object on its left side:

<head><script>
function fnClear(){
    oClear.style.clear="left";
}
function fnClear2(){
    oClear.style.clear="none";
}
</script>
</head>
<body>
<img src="/workshop/graphics/sphere.jpg" style="float:left">
    <span id="oClear">
        <p>This is an example of the clear property.<p>
    </span>

    <p>
        <input type=button value ="clear = left" onclick="fnClear()"> 
        <input type=button value ="clear = none" onclick="fnClear2()">
    </p>
</body>

Standards information

Applies to

a, address, applet, b, big, blockquote, button, caption, center, cite, code, col, colgroup, custom, dd, defaults, dfn, div, dl, dt, em, embed, fieldset, form, hn, hr, i, iframe, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, li, object, ol, option, p, s, select, span, sub, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var, xmp

See also

Concepts

float

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft