Export (0) Print
Expand All

overflow

Sets a value indicating how to manage the content of the object when the content exceeds the height or width of the object.

{ overflow: sOverflow }

sOverflow

String that specifies or receives one of the following values:

visible

Default. Content is not clipped and scroll bars are not added.

auto

Content is clipped and scrolling is added only when necessary.

hidden

Content that exceeds the dimensions of the object is not shown.

scroll

Content is clipped and scroll bars are added, even if the content does not exceed the dimensions of the object.

The property has a default value of visible for all objects, with the exception of textarea which has a default value of auto. This property is not inherited.

The default value for the BODY element is auto.

Setting the overflow property to hidden on a textarea object hides its scroll bars.

Setting the overflow property to visible causes the content to be clipped to the size of the window or frame that contains the object.

The following example uses the overflow property to manage content of the object. This example uses an inline style to automatically adjust itself to overflowing content when the page is loaded:

<div id=odiv style="width: 200px; height: 200px; overflow: auto;">
:
</div>

In this example, the user can dynamically change the overflow property of a DIV object by choosing one of the possible overflow values from a SELECT object:

<script>
function SetOverflow(o, svalue )
{
    o.style.overflow = svalue ;
}
</script>

<div id="div1" 
    style="font-size:18pt;background-color:yellow;height:50px;width:75px">
The quick brown fox jumps over the lazy dog.
</div>

<select onchange="SetOverflow(div1,
    this.options[this.selectedIndex].text)">
<option selected>visible
<option>scroll
<option>hidden
<option>auto
</select>

A, ABBR, ACRONYM, ADDRESS, APPLET, B, BDO, BIG, BLOCKQUOTE, BODY, CENTER, CITE, CODE, COL, COLGROUP, CUSTOM, DD, DEFAULTS, DEL, DFN, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, HTML, HN, I, 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, INS, LI, OL, P, Q, RT, RUBY, S, SPAN, SUB, TT, U, UL, VAR, XMP

Community Additions

ADD
Show:
© 2015 Microsoft