Skip to content

Commit de0d18a

Browse files
authored
Rollup merge of #105155 - notriddle:notriddle/flexbox-help-settings-buttons, r=GuillaumeGomez
rustdoc: clean up help and settings button CSS The old version of this code specified a bunch of different numbers that had to line up just right to get the size it wanted. This version uses flexbox centering, specifies the font size, and lets the browser figure out the rest of the layout automatically. Preview: http://notriddle.com/notriddle-rustdoc-demos/flexbox-help-settings-buttons/test_dingus/
2 parents b5b2d03 + efdec6d commit de0d18a

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

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

+10-19
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
908908

909909
.popover {
910910
position: absolute;
911+
top: 100%;
911912
right: 0;
912913
z-index: 2;
913914
display: block;
@@ -1357,22 +1358,24 @@ a.test-arrow:hover {
13571358
}
13581359
#settings-menu, #help-button {
13591360
margin-left: 4px;
1360-
outline: none;
1361+
display: flex;
13611362
}
13621363

13631364
#settings-menu > a, #help-button > a, #copy-path {
13641365
width: 33px;
1365-
line-height: 1.5;
13661366
}
13671367

13681368
#settings-menu > a, #help-button > a {
1369-
padding: 5px;
1370-
height: 100%;
1371-
display: block;
1369+
display: flex;
1370+
align-items: center;
1371+
justify-content: center;
13721372
background-color: var(--button-background-color);
13731373
border: 1px solid var(--border-color);
13741374
border-radius: 2px;
13751375
color: var(--settings-button-color);
1376+
/* Rare exception to specifying font sizes in rem. Since this is acting
1377+
as an icon, it's okay to specify their sizes in pixels. */
1378+
font-size: 20px;
13761379
}
13771380

13781381
#settings-menu > a:hover, #settings-menu > a:focus,
@@ -1408,14 +1411,6 @@ a.test-arrow:hover {
14081411
animation: rotating 2s linear infinite;
14091412
}
14101413

1411-
#help-button > a {
1412-
text-align: center;
1413-
/* Rare exception to specifying font sizes in rem. Since this is acting
1414-
as an icon, it's okay to specify their sizes in pixels. */
1415-
font-size: 20px;
1416-
padding-top: 2px;
1417-
}
1418-
14191414
kbd {
14201415
display: inline-block;
14211416
padding: 3px 5px;
@@ -1658,10 +1653,6 @@ in storage.js
16581653
content: "Since ";
16591654
}
16601655

1661-
#copy-path {
1662-
display: none;
1663-
}
1664-
16651656
/* Hide the logo and item name from the sidebar. Those are displayed
16661657
in the mobile-topbar instead. */
16671658
.sidebar .sidebar-logo,
@@ -1795,8 +1786,8 @@ in storage.js
17951786
border-bottom: 1px solid;
17961787
}
17971788

1798-
/* We don't display the help button on mobile devices. */
1799-
#help-button {
1789+
/* We don't display these buttons on mobile devices. */
1790+
#copy-path, #help-button {
18001791
display: none;
18011792
}
18021793

0 commit comments

Comments
 (0)