Remove and retain the iframe scroll bar.

Source: Internet
Author: User

Remove and retain the iframe scroll bar.

After an iframe is embedded into a page, we sometimes need to adjust the scroll bar. For example, we need to remove all the scroll bars, remove the scroll bar on the right, keep the scroll bar on the bottom, remove the scroll bar on the bottom, and keep the scroll bar on the right. So what should we do?

I. Remove all the scroll bars.

The first method: iframe has a scrolling attribute, which has three values: auto, yes, and no.

Scrolling: auto ----- the scroll bar appears when necessary

Scrolling: yes ------ always display the scroll bar

Scrolling: no ------- always hide the scroll bar

When scrolling: no is set, no scroll bars are available.

Method 2: I found that apart from scrolling, you can remove all the scroll bars. In addition, you can set body {overflow: hidden} on the embedded page. In this way, you can also remove the scroll bar, this is also the attribute used when we only want to remove a scroll bar.

 

2. Remove the scroll bar on the right and keep the scroll bar under it.

If you only want to keep the scroll bar below, you can set body {overflow-x: auto; overflow-y: hidden;} in the embedded page ;}

 

3. Remove the scroll bar and keep the scroll bar on the right.

Set body {overflow-x: hidden; overflow-y: auto;} on the embedded page ;}

We already know that both attributes can be set to display and hide the scroll bar. What effect will happen when both attributes are set at the same time?

Through detection, I found that when scrolling = "auto" or "yes", if the body is set, the settings in the body will be used; When scrolling = "no, no matter what the body is set, scrolling settings are used, that is, all the scroll bars are removed.

 

Related Article

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.