- Các trình duyệt như Chrome, Safari và Opera hỗ trợ tiêu chuẩn này.
- Các trình duyệt như Firefox thì không hỗ trợ.
- ::-webkit-scrollbar: chính là scrollbar.
- ::-webkit-scrollbar-button: các mũi tên lên xuống trên scrollbar.
- ::-webkit-scrollbar-thumb: phần handle có thể kéo để cuộn trang.
- ::-webkit-scrollbar-track: thanh tiến trình của scrollbar.
- ::-webkit-scrollbar-track-piece: vùng không bị handle che khuất.
- ::-webkit-scrollbar-corner: góc dưới của scrollbar nơi giao nhau.
- ::-webkit-resizer: handle kéo để thay đổi kích thước ở góc dưới.
<!Doctype>
<html>
<head>
<title>scroll customization</title>
<style type="text/css">
body {
font-size: 20pt;
}
/* tells the browser how the bar will look */
::-webkit-scrollbar {
width: 15px;
border: 2px solid blue;
}
/*tells the browser how the arrows will appear*/
::-webkit-scrollbar-button:single-button {
background-color: red;
height: 16px;
width: 16px;
}
/* tells the browser how the scrollable
handle would look like */
::-webkit-scrollbar-thumb {
background: black;
}
/* tells the browser how will the
path of the handle will look like */
::-webkit-scrollbar-track {
background: yellow;
}
/* works the same as ::-webkit-scrollbar-track
but tells the browser how the path where
the handle is not present currently*/
/* ::-webkit-scrollbar-track-piece{
background: green;
} */
/* tells the browser how will the point
where vertical and horizontal meet will look like*/
/* ::-webkit-scrollbar-corner{
background: orange ;
display: solid;
} */
/* resizer*/
::-webkit-resizer {
background: pink;
}
</style>
</head>
<body>
<center>
<h1 style="color:green">GeeksforGeeks</h1>
<h2>CSS |::-webkit-scrollbar</h2>
<p>HTML stands for Hyper Text Markup Language.
It is used to design web pages using markup language.
HTML is the combination of Hypertext and Markup language.
Hypertext defines the link between
the web pages. Markup language is used to
define the text document within tag which
defines the structure of web pages.</p>
<br>
<p>HTML is a markup language which is used by
the browser to manipulate text, images and
other content to display it in required format.</p>
<br>
<p>Cascading Style Sheets, fondly
referred to as CSS, is a simply
designed language intended to simplify
the process of making web
pages presentable. CSS allows you to
apply styles to web pages.
More importantly, CSS enables you to
do this independent of the
HTML that makes up each web page.</p>
</center>
</body>
</html>
**Kết quả:**
- Google Chrome
- Apple Safari
- Opera