Several lines of code can easily solve the scroll bar style problem, which can be called an artifact and several lines of scroll bars.

Source: Internet
Author: User

Several lines of code can easily solve the scroll bar style problem, which can be called an artifact and several lines of scroll bars.

I believe many colleagues have been confused about the scroll bar styles of various browsers, and the default scroll bar styles of different browsers are inconsistent. There are also many sayings on the Internet to modify the scroll bar style, but most of them are full of abuse. Today, I only talk about dry goods, pure dry goods, and dry goods are recommended by one of my colleagues. Here, I would like to thank my colleagues and thank you.

Step 1: Insert the following code in the style <style> </style> label:

1/* set the scroll bar style */2 3:-webkit-scrollbar {4 width: 5px; 5 height: 5px; 6} 7 8/* scroll slot */9 10:-webkit-scrollbar-track {11-webkit-box-shadow: inset 0 0 6px rgba (0, 0, 0, 0.3); 12 border-radius: 5px; 13} 14 15/* scroll bar slider */16 17:-webkit-scrollbar-thumb {18 border-radius: 10px; 19 background: rgba (0, 0, 0, 0.1); 20-webkit-box-shadow: inset 0 6px rgba (0, 0, 0, 0.5); 21}
View Code

Step 2: Add a style to the container

Overflow: auto; (or overflow-y: auto; or overflow-x: auto ;)

The effect will not be posted, let you witness the miracle moment in person! No effect. Please drop bricks ~

 

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.