Skip to content

Commit ebee589

Browse files
committed
rustdoc: clean up sidebar width CSS
This commit takes advantage of the ability to set [flex-basis] to a specific length instead of setting it to `auto` and changing min-/max-width, and setting flex-grow/-shrink both to 0. [flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis
1 parent 251831e commit ebee589

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/librustdoc/html/static/css/rustdoc.css

+4-9
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,7 @@ img {
387387

388388
.sidebar {
389389
font-size: 0.875rem;
390-
width: 200px;
391-
min-width: 200px;
390+
flex: 0 0 200px;
392391
overflow-y: scroll;
393392
position: sticky;
394393
height: 100vh;
@@ -397,12 +396,7 @@ img {
397396
}
398397

399398
.rustdoc.source .sidebar {
400-
width: 50px;
401-
min-width: 0px;
402-
max-width: 300px;
403-
flex-grow: 0;
404-
flex-shrink: 0;
405-
flex-basis: auto;
399+
flex-basis: 50px;
406400
border-right: 1px solid;
407401
overflow-x: hidden;
408402
/* The sidebar is by default hidden */
@@ -423,7 +417,7 @@ img {
423417

424418
.source-sidebar-expanded .source .sidebar {
425419
overflow-y: auto;
426-
width: 300px;
420+
flex-basis: 300px;
427421
}
428422

429423
.source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) {
@@ -1702,6 +1696,7 @@ in storage.js
17021696
z-index: 11;
17031697
/* Reduce height slightly to account for mobile topbar. */
17041698
height: calc(100vh - 45px);
1699+
width: 200px;
17051700
}
17061701

17071702
/* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,

0 commit comments

Comments
 (0)