Skip to content

Commit efdec6d

Browse files
committed
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.
1 parent 6ab34f4 commit efdec6d

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

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

+8-13
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
911911

912912
.popover {
913913
position: absolute;
914+
top: 100%;
914915
right: 0;
915916
z-index: 2;
916917
display: block;
@@ -1360,22 +1361,24 @@ a.test-arrow:hover {
13601361
}
13611362
#settings-menu, #help-button {
13621363
margin-left: 4px;
1363-
outline: none;
1364+
display: flex;
13641365
}
13651366

13661367
#settings-menu > a, #help-button > a, #copy-path {
13671368
width: 33px;
1368-
line-height: 1.5;
13691369
}
13701370

13711371
#settings-menu > a, #help-button > a {
1372-
padding: 5px;
1373-
height: 100%;
1374-
display: block;
1372+
display: flex;
1373+
align-items: center;
1374+
justify-content: center;
13751375
background-color: var(--button-background-color);
13761376
border: 1px solid var(--border-color);
13771377
border-radius: 2px;
13781378
color: var(--settings-button-color);
1379+
/* Rare exception to specifying font sizes in rem. Since this is acting
1380+
as an icon, it's okay to specify their sizes in pixels. */
1381+
font-size: 20px;
13791382
}
13801383

13811384
#settings-menu > a:hover, #settings-menu > a:focus,
@@ -1411,14 +1414,6 @@ a.test-arrow:hover {
14111414
animation: rotating 2s linear infinite;
14121415
}
14131416

1414-
#help-button > a {
1415-
text-align: center;
1416-
/* Rare exception to specifying font sizes in rem. Since this is acting
1417-
as an icon, it's okay to specify their sizes in pixels. */
1418-
font-size: 20px;
1419-
padding-top: 2px;
1420-
}
1421-
14221417
kbd {
14231418
display: inline-block;
14241419
padding: 3px 5px;

0 commit comments

Comments
 (0)