Css Hide the scroll bar (horizontal, sticky)

Source: Internet
Author: User

Add scroll = "no" to <boby> to hide the scroll bar;

Add style = "overflow-x: hidden" to <boby> to hide the horizontal scroll bar. Add style = "overflow-y: hidden" to hide the vertical scroll bar.

1. Completely hidden

Add scroll = "no" to hide the scroll bar;

2. Hide it when it is not needed

When the browser window width or height is greater than the page width or height, no scroll bar is displayed; otherwise, it is displayed;

3. Style sheet method

Add style = "overflow-x: hidden" to hide the horizontal scroll bar;

Add style = "overflow-y: hidden" to hide the vertical scroll bar.

Add to included page

The following is an explanation: body {overflow-x: hidden;} is not allowed in the standard DTD.

Html {overflow: scroll ;}

Force hide the scroll bar:

Html {overflow: hidden ;}

Hide the horizontal scroll bar of IE:

Html {overflow-x: hidden ;}

Hide the vertical scroll bar of IE:

Html {overflow-y: hidden ;}

Forcibly display the horizontal scroll bar of IE:

Html {overflow-x: scroll ;}

Forcibly display the vertical scroll bar of IE:

Html {overflow-y: scroll ;}

Force Display of Mozilla horizontal scroll bar:

Html {overflow:-moz-scrollbars-horizontal ;}

Note: Only the horizontal scroll bar is forcibly displayed. That is to say, even if the vertical scroll bar needs to be displayed, the vertical scroll bar will not appear.

Force Display of Mozilla's vertical scroll bar:

Html {overflow:-moz-scrollbars-vertical ;}

Note: only the vertical scroll bar is displayed. That is to say, the horizontal scroll bar does not appear even if the horizontal scroll bar needs to be displayed.

The final solution:

Add on the page:

The code is as follows: Copy code

<Style>
Html {overflow-x: hidden; // hide the horizontal scroll bar overflow-y: hidden; // hide the vertical scroll bar}
</Style>

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.