diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index d7f33d6131c..b8dd177e2d9 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1755,6 +1755,12 @@ details.rustdoc-toggle[open] > summary.hideme::after {
padding-top: 0px;
}
+ /* Space is at a premium on mobile, so remove the theme-picker icon. */
+ #theme-picker {
+ display: none;
+ width: 0;
+ }
+
.rustdoc {
flex-direction: column;
}
@@ -1873,12 +1879,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
height: 100%;
}
- nav.sub {
- width: calc(100% - 32px);
- margin-left: 32px;
- margin-bottom: 10px;
- }
-
.source nav:not(.sidebar).sub {
margin-left: 32px;
}
@@ -2075,11 +2075,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
border: 0;
}
- #crate-search + .search-input {
- width: calc(100% + 71px);
- margin-left: -36px;
- }
-
#theme-picker, #settings-menu {
padding: 5px;
width: 31px;
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index f41c1bd817a..011e60b8fa0 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -129,10 +129,15 @@ function hideThemeButtonState() {
// Set up the theme picker list.
(function () {
+ if (!document.location.href.startsWith("file:///")) {
+ return;
+ }
var themeChoices = getThemesElement();
var themePicker = getThemePickerElement();
var availableThemes = getVar("themes").split(",");
+ removeClass(themeChoices.parentElement, "hidden");
+
function switchThemeButtonState() {
if (themeChoices.style.display === "block") {
hideThemeButtonState();
diff --git a/src/librustdoc/templates/page.html b/src/librustdoc/templates/page.html
index 02808754b53..1ef001ec2b7 100644
--- a/src/librustdoc/templates/page.html
+++ b/src/librustdoc/templates/page.html
@@ -96,7 +96,7 @@
{%- endif -%}
{#- -#}