CSS - div之overflow:scroll

Definition

Theoverflowpropertyspecifieswhathappensifcontentoverflowsanelement'sbox.

Usage

Defaultvalue:visible

Inherited:no

Version:CSS2

JavaScriptsyntax:object.style.overflow="scroll"

PropertyValues

ValueDescription

visibleTheoverflowisnotclipped.

Itrendersoutsidetheelement'sbox.

Thisisdefault

hiddenTheoverflowisclipped,

andtherestofthecontentwillbeinvisible

scrollTheoverflowisclipped,

butascroll-barisaddedtoseetherestofthecontent

autoIfoverflowisclipped,

ascroll-barshouldbeaddedtoseetherestofthecontent

inheritSpecifiesthatthevalueoftheoverflowproperty

shouldbeinheritedfromtheparentelement.

如果只有文本超出div宽度时,才显示scroll,

则设为:overflow:auto

当然,还可以指定:

overflow-x:auto;

overflow-y:auto;

http://www.w3schools.com/cssref/pr_pos_overflow.asp

-

相关推荐