Skip to content

Commit df06aa7

Browse files
committed
Fix font sizes for rightside contents
This gives more specific selectors for the font sizes assigned to various headings. This avoids an issue where we set a font size for a given heading level, and then have to override it, and override it again. This also allows us to set the font size for impls on the impl div. Also, change from `em` to `rem` when specifying font sizes. That avoids a "compounding" problem when a font-size in em is specified multiple times: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size#rems
1 parent d331cb7 commit df06aa7

File tree

5 files changed

+36
-20
lines changed

5 files changed

+36
-20
lines changed

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

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,27 @@ body {
118118
}
119119

120120
h1 {
121-
font-size: 1.5em;
121+
font-size: 1.5rem;
122122
}
123123
h2 {
124-
font-size: 1.4em;
124+
font-size: 7.4rem;
125+
}
126+
h2.section-header,
127+
h2.small-section-header,
128+
.sidebar h2,
129+
#help h2 {
130+
font-size: 1.4rem;
125131
}
126132
h3 {
127-
font-size: 1.3em;
133+
font-size: 7.3rem;
134+
}
135+
h3.section-header,
136+
h3.small-section-header,
137+
h3.search-loading,
138+
.sidebar h3 {
139+
font-size: 1.3rem;
128140
}
141+
129142
h1, h2, h3, h4, h5, h6 {
130143
font-weight: 500;
131144
}
@@ -136,6 +149,7 @@ h1, h2, h3, h4 {
136149
.docblock h3, .docblock h4, h5, h6 {
137150
margin: 15px 0 5px 0;
138151
}
152+
139153
h1.fqn {
140154
display: flex;
141155
border-bottom: 1px dashed;
@@ -159,12 +173,14 @@ h2,
159173
.sidebar .others h3 {
160174
border-bottom: 1px solid;
161175
}
176+
.impl,
162177
h3.code-header {
163-
font-size: 1.1em;
178+
font-size: 1.1rem;
164179
}
165180
h4.code-header {
166-
font-size: 1em;
181+
font-size: 1rem;
167182
}
183+
168184
h3.code-header, h4.code-header {
169185
font-weight: 600;
170186
border-bottom-style: none;
@@ -545,6 +561,10 @@ nav.sub {
545561
position: relative;
546562
}
547563

564+
.search-loading {
565+
text-align: center;
566+
}
567+
548568
#results > table {
549569
width: 100%;
550570
table-layout: fixed;
@@ -579,18 +599,18 @@ nav.sub {
579599
white-space: pre-wrap;
580600
}
581601

582-
.top-doc .docblock h2 { font-size: 1.3em; }
583-
.top-doc .docblock h3 { font-size: 1.15em; }
602+
.top-doc .docblock h2 { font-size: 1.3rem; }
603+
.top-doc .docblock h3 { font-size: 1.15rem; }
584604
.top-doc .docblock h4,
585605
.top-doc .docblock h5 {
586-
font-size: 1.1em;
606+
font-size: 1.1rem;
587607
}
588608
.top-doc .docblock h6 {
589-
font-size: 1em;
609+
font-size: 1rem;
590610
}
591611

592-
.docblock h5 { font-size: 1em; }
593-
.docblock h6 { font-size: 0.95em; }
612+
.docblock h5 { font-size: 1rem; }
613+
.docblock h6 { font-size: 0.95rem; }
594614

595615
.docblock {
596616
margin-left: 24px;
@@ -835,7 +855,6 @@ h2.small-section-header > .anchor {
835855
position: absolute;
836856
top: 0;
837857
right: 0;
838-
font-size: 17px;
839858
font-weight: normal;
840859
}
841860

@@ -1030,7 +1049,7 @@ body.blur > :not(#help) {
10301049
.stab {
10311050
padding: 3px;
10321051
margin-bottom: 5px;
1033-
font-size: 90%;
1052+
font-size: 0.9rem;
10341053
font-weight: normal;
10351054
}
10361055
.stab p {
@@ -1069,7 +1088,6 @@ body.blur > :not(#help) {
10691088

10701089
.since {
10711090
font-weight: normal;
1072-
font-size: initial;
10731091
}
10741092

10751093
.impl-items .since, .impl .since, .methods .since {
@@ -1080,7 +1098,6 @@ body.blur > :not(#help) {
10801098

10811099
.impl-items .srclink, .impl .srclink, .methods .srclink {
10821100
/* Override header settings otherwise it's too bold */
1083-
font-size: 17px;
10841101
font-weight: normal;
10851102
}
10861103

@@ -1089,7 +1106,6 @@ body.blur > :not(#help) {
10891106
}
10901107

10911108
.has-srclink {
1092-
font-size: 16px;
10931109
margin-bottom: 12px;
10941110
/* Push the src link out to the right edge consistently */
10951111
justify-content: space-between;

src/librustdoc/html/static/css/themes/ayu.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ a.test-arrow:hover {
345345
color: #999;
346346
}
347347

348-
:target, :target > * {
348+
:target {
349349
background: rgba(255, 236, 164, 0.06);
350350
}
351351

src/librustdoc/html/static/css/themes/dark.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ a.test-arrow:hover{
293293
color: #999;
294294
}
295295

296-
:target, :target > * {
296+
:target {
297297
background-color: #494a3d;
298298
}
299299

src/librustdoc/html/static/css/themes/light.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ a.test-arrow:hover{
280280
color: #999;
281281
}
282282

283-
:target, :target > * {
283+
:target {
284284
background: #FDFFD3;
285285
}
286286

src/librustdoc/html/static/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ function hideThemeButtonState() {
289289
var params = searchState.getQueryStringParams();
290290
if (params.search !== undefined) {
291291
var search = searchState.outputElement();
292-
search.innerHTML = "<h3 style=\"text-align: center;\">" +
292+
search.innerHTML = "<h3 class=\"search-loading\">" +
293293
searchState.loadingText + "</h3>";
294294
searchState.showResults(search);
295295
loadSearch();

0 commit comments

Comments
 (0)