Div: Add a scroll bar to the DIV to set the scroll bar of the DIV

Source: Internet
Author: User

An example is provided today:

Div scroll bar:

Two methods:

I,

<Div style = "overflow: Scroll; width: 400px; Height: 400px;"> </div>

Remember to set up width and height.

The following scroll bar is available only when the limit is not exceeded, so it is not the best choice.

 

II,

<Div style = "overflow-Y: auto; overflow-X: auto; width: 400px; Height: 400px;"> </div>

Remember to set up width and height.

In this way, it is better to say that when the width and height do not exceed, it is just a line.

Iii. Description

You can directly specify the overflow attribute as auto for the DIV, but you must specify the height of the DIV, for example:

<Div style = "position: absolute; Height: 400px; overflow: Auto">

</Div>

If a horizontal scroll bar is to appear, overflow-X: Auto

Similarly, the vertical scroll bar is: overflow-Y: Auto

If the DIV is included in another object such as TD, the position can be set to relative: Position: relative.

 

Div: Add a scroll bar to the DIV to set the scroll bar of the DIV

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.