clear Attribute | clear Property

DHTML, HTML, & CSS

clear Attribute | clear Property


Sets or retrieves whether the object allows floating objects on its left and/or right sides, so that the next text displays past the floating objects.

Syntax

HTML{ clear: sClear }
Scriptingobject.style.clear [ = sClear ]

Possible Values

sClear String that specifies one of the following values:
noneFloating objects are allowed on both sides.
leftObject is moved below any floating object on the left side.
rightObject is moved below any floating object on the right side.
bothObject is moved below any floating object.

The property is read/write with a default value of none; the cascading style sheets (CSS) attribute is not inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

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

Example

The following examples use the clear attribute and 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.

Sample Code

<STYLE>
    I { clear:left }
</STYLE>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

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 attribute.<P>
    </span>

    <P>
        <INPUT TYPE=button value="clear = left" onclick="fnClear()"> 
        <INPUT TYPE=button value="clear = none" onclick="fnClear2()">
    </P>
</BODY>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ADDRESS, APPLET, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, currentStyle, custom, DD, DFN, DIR, 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, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, runtimeStyle, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.