css實現div自動添加捲軸

來源:互聯網
上載者:User

原來用過,沒有太在意,最近又用到。記下方便以後用。

<div style='border:0px;padding:3px; PADDING:0px; width:200px; height:480px; LINE-HEIGHT: 20px; OVERFLOW: auto; '></div>

文法:

 

overflow : visible | auto | hidden | scroll ;

 

參數:

 

1.visible :不剪下內容也不添加捲軸。假如顯式聲明此預設值,對象將被剪下為包含對象的window或frame的大小。並且clip屬性設定將失效

2.auto :此為body對象和textarea的預設值。在需要時剪下內容並添加捲軸

3.hidden :不顯示超過對象尺寸的內容

4.scroll :總是顯示捲軸

 

說明:

 

檢索或設定當對象的內容超過其指定高度及寬度時如何管理內容。

設定textarea對象為hidden值將隱藏其捲軸。

對於table來說,假如table-layout屬性設定為fixed,則td對象支援帶有預設值為hidden的overflow屬性。如果設為hidden,scroll或者auto,那麼超出td尺寸的內容將被剪下。如果設為visible,將導致額外的文本溢出到右邊或左邊(視direction屬性設定而定)的儲存格。

自IE5開始,此屬性在MAC平台上可用。

對應的指令碼特性為overflow。

 

樣本:

div { overflow: scroll; height: 100px; width: 100px; }

效果

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.