diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index d091cc0c0965b843aac5805924824bae298026fe..0ab130009ca0dafbb28bc992369f09f045ef5ab4 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -182,6 +182,18 @@ nav.sub {
top: 0;
bottom: 0;
overflow: auto;
+ /* Improve the sidebar display on firefox */
+ scrollbar-width: thin;
+}
+
+/* Improve the sidebar display on webkit-based browsers */
+.sidebar::-webkit-scrollbar {
+ width: 8px;
+}
+
+/* Improve the sidebar display on webkit-based browsers */
+.sidebar::-webkit-scrollbar-track {
+ -webkit-box-shadow: inset 0;
}
.sidebar .block > ul > li {
diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css
index ff32a0fa09e4d1a9c26f274f05733b1ac2beb47b..155492e8a6a7ce5c41c8dc98af30d8de441cbec0 100644
--- a/src/librustdoc/html/static/themes/dark.css
+++ b/src/librustdoc/html/static/themes/dark.css
@@ -30,6 +30,18 @@ pre {
.sidebar {
background-color: #505050;
+ /* Improve the sidebar display on firefox */
+ scrollbar-color: rgba(32,34,37,.6) transparent;
+}
+
+/* Improve the sidebar display on webkit-based browsers */
+.sidebar::-webkit-scrollbar-track {
+ background-color: #717171;
+}
+
+/* Improve the sidebar display on webkit-based browsers */
+.sidebar::-webkit-scrollbar-thumb {
+ background-color: rgba(32, 34, 37, .6);
}
.sidebar .current {
diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css
index 2b2819f7126b4aa2582623296248fd3424e42f41..488c34a61fb9fa62f7aa3ff8700b1beb5f0dee2b 100644
--- a/src/librustdoc/html/static/themes/light.css
+++ b/src/librustdoc/html/static/themes/light.css
@@ -32,6 +32,18 @@ pre {
.sidebar {
background-color: #F1F1F1;
+ /* Improve the sidebar display on firefox */
+ scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9;
+}
+
+/* Improve the sidebar display on webkit-based browsers */
+.sidebar::-webkit-scrollbar-track {
+ background-color: #dcdcdc;
+}
+
+/* Improve the sidebar display on webkit-based browsers */
+.sidebar::-webkit-scrollbar-thumb {
+ background-color: rgba(36, 37, 39, 0.6);
}
.sidebar .current {