Skip to content

Commit

Permalink
Auto merge of rust-lang#122693 - ehuss:rust-css-header, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Fix heading anchors in doc pages.

This fixes the heading anchors on the standalone doc pages (the index, releases, etc.) so that the § symbol is only shown when the user hovers over the heading. This was changed in rust-lang#117662, but this CSS was not updated.
  • Loading branch information
bors committed Mar 18, 2024
2 parents d31b6fb + 39f2d25 commit e96739a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/doc/rust.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,28 @@ h1 a:link, h1 a:visited, h2 a:link, h2 a:visited,
h3 a:link, h3 a:visited, h4 a:link, h4 a:visited,
h5 a:link, h5 a:visited {color: black;}

h1, h2, h3, h4, h5 {
/* This is needed to be able to position the doc-anchor. Ideally there
would be a <div> around the whole document, but we don't have that. */
position: relative;
}

a.doc-anchor {
color: black;
display: none;
position: absolute;
left: -20px;
/* We add this padding so that when the cursor moves from the heading's text to the anchor,
the anchor doesn't disappear. */
padding-right: 5px;
/* And this padding is used to make the anchor larger and easier to click on. */
padding-left: 3px;
}
*:hover > .doc-anchor {
display: block;
}


/* Code */

pre, code {
Expand Down

0 comments on commit e96739a

Please sign in to comment.