Custom page scroll bar

Source: Internet
Author: User

A scroll bar is a pseudo element that can be customized. This pseudo class can render WebKit's own scroll bar and only render it according to the custom CSS information.

/* Scroll bar */
:-WebKit-scrollbar {Height: 7px; width: 10px;} // The width can also be defined as a percentage.

// The slider in the scroll bar
:-WebKit-scrollbar-thumb {
Min-Height: 30px;
Background: rgba (0, 0,. 5 );
Border-radius: 100px;
Box-Shadow: 0 0 1px 1px rgba (255,255,255, 0.25 );
}
:-WebKit-scrollbar-thumb: hover {Background: rgba (0, 0,. 7 );}
:-WebKit-scrollbar-thumb: Active {Background: rgba (0, 0,. 8 );}

// Scroll bar track

//: Horizontal (the horizontal pseudo class applies to the scroll bars in any horizontal direction)

//: Vertical (vertical pseudo class applies to scroll bars in any vertical direction)

:-WebKit-scrollbar-Track: vertical {
Background:-WebKit-gradient (linear, 0 0,100% 0, from (rgba (0, 0, 0 ,. 13), to (rgba (0, 0, 0 ,. 13), color-stop (. 5, rgba (0, 0, 0 ,. 05 )));
}
:-WebKit-scrollbar-Track: horizontal {
Background:-WebKit-gradient (linear, 0 0, 0 100%, from (rgba (, 0, 0 ,. 13), to (rgba (0, 0, 0 ,. 13), color-stop (. 5, rgba (0, 0, 0 ,. 05 )));
}

:-WebKit-scrollbar-corner {Background: # e7e7e7 ;}

:-WebKit-scrollbar-thumb: window-inactive {
/* When the focus is not in the status of the slider in the current area */

}

 

Http://edu.cnzz.cn/201212/836936e7.shtml for more information

Custom page scroll bar

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.