diff --git a/index.html b/index.html index b6f6d0214..c64d578b8 100644 --- a/index.html +++ b/index.html @@ -31,6 +31,7 @@ Overflow scroll gradient Popout menu Pretty text underline + Scrollbars styling Shape separator System font stack Triangle @@ -918,6 +919,76 @@ var y = e.pageY - btn.offsetTop - btn.offsetParent.offsetTop +
Customise scrollbars style for the document and elements with overflow scrollable, on webkit platforms.
+<div class="custom-scroll">
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure id exercitationem nulla qui repellat laborum vitae, molestias tempora velit natus. Quas, assumenda nisi. Quisquam enim qui iure, consequatur velit sit?</p>
+</div>
+
+ ::-webkit-scrollbar {
+ width: 8px;
+}
+::-webkit-scrollbar-track {
+ box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
+ border-radius: 10px;
+}
+::-webkit-scrollbar-thumb {
+ border-radius: 10px;
+ box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
+}
+
+ ::-webkit-scrollbar target the whole scrollbar element.::-webkit-scrollbar-track target only the scrollbar track.::-webkit-scrollbar-thumb Allow you to target and style the scrollbar thumb.There are many other pseudo elements that you can use to style scrollbars. More info about this on the + WebKit Blog +
+⚠️ Currently scrollbar styling doesn't appear to be on any standards track. +
+ +Uses an SVG shape to separate two different blocks to create more a interesting visual appearance compared to standard horizontal separation.
diff --git a/snippets/scrollbars-styling.md b/snippets/scrollbars-styling.md new file mode 100644 index 000000000..f4da38705 --- /dev/null +++ b/snippets/scrollbars-styling.md @@ -0,0 +1,78 @@ +### Scrollbars styling + +Customise scrollbars style for the document and elements with overflow scrollable, on webkit platforms. + +#### HTML + +```html +Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure id exercitationem nulla qui repellat laborum vitae, molestias tempora velit natus. Quas, assumenda nisi. Quisquam enim qui iure, consequatur velit sit?
+