Debian Codegraph @

crates/mdbook-html/front-end/css/general.css

raw
1 /* Base styles and content styles */
2
3 :root {
4 /* Browser default font-size is 16px, this way 1 rem = 10px */
5 font-size: 62.5%;
6 color-scheme: var(--color-scheme);
7 }
8
9 html {
10 font-family: "Open Sans", sans-serif;
11 color: var(--fg);
12 background-color: var(--bg);
13 text-size-adjust: none;
14 -webkit-text-size-adjust: none;
15 }
16
17 body {
18 margin: 0;
19 font-size: 1.6rem;
20 overflow-x: hidden;
21 }
22
23 code {
24 font-family: var(--mono-font) !important;
25 font-size: var(--code-font-size);
26 direction: ltr !important;
27 }
28
29 /* make long words/inline code not x overflow */
30 main {
31 overflow-wrap: break-word;
32 }
33
34 /* make wide tables scroll if they overflow */
35 .table-wrapper {
36 overflow-x: auto;
37 }
38
39 /* Don't change font size in headers. */
40 h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
41 font-size: unset;
42 }
43
44 .left { float: left; }
45 .right { float: right; }
46 .boring { opacity: 0.6; }
47 .hide-boring .boring { display: none; }
48 .hidden { display: none !important; }
49
50 h2, h3 { margin-block-start: 2.5em; }
51 h4, h5 { margin-block-start: 2em; }
52
53 .header + .header h3,
54 .header + .header h4,
55 .header + .header h5 {
56 margin-block-start: 1em;
57 }
58
59 h1:target::before,
60 h2:target::before,
61 h3:target::before,
62 h4:target::before,
63 h5:target::before,
64 h6:target::before,
65 dt:target::before {
66 display: inline-block;
67 content: "»";
68 margin-inline-start: -30px;
69 width: 30px;
70 }
71
72 /* This is broken on Safari as of version 14, but is fixed
73 in Safari Technology Preview 117 which I think will be Safari 14.2.
74 https://bugs.webkit.org/show_bug.cgi?id=218076
75 */
76 :target {
77 /* Safari does not support logical properties */
78 scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
79 }
80
81 .page {
82 outline: 0;
83 padding: 0 var(--page-padding);
84 margin-block-start: calc(0px - var(--menu-bar-height)); /* Compensate for the #mdbook-menu-bar-hover-placeholder */
85 }
86 .page-wrapper {
87 box-sizing: border-box;
88 background-color: var(--bg);
89 }
90 html:not(.js) .page-wrapper,
91 .js:not(.sidebar-resizing) .page-wrapper {
92 transition: margin-left 0.3s ease, transform 0.3s ease; /* Animation: slide away */
93 }
94 [dir=rtl]:not(.js) .page-wrapper,
95 [dir=rtl].js:not(.sidebar-resizing) .page-wrapper {
96 transition: margin-right 0.3s ease, transform 0.3s ease; /* Animation: slide away */
97 }
98
99 .content {
100 overflow-y: auto;
101 padding: 0 5px 50px 5px;
102 }
103 .content main {
104 margin-inline-start: auto;
105 margin-inline-end: auto;
106 max-width: var(--content-max-width);
107 }
108 .content p { line-height: 1.45em; }
109 .content ol { line-height: 1.45em; }
110 .content ul { line-height: 1.45em; }
111 .content a { text-decoration: none; }
112 .content a:hover { text-decoration: underline; }
113 .content img, .content video { max-width: 100%; }
114 /* When an image is inside an anchor, ensure the focus ring covers the entire
115 image instead of the anchor's line box. */
116 .content a:has(img) { display: inline-block; }
117 .content .header:link,
118 .content .header:visited {
119 color: var(--fg);
120 }
121 .content .header:link,
122 .content .header:visited:hover {
123 text-decoration: none;
124 }
125
126 table {
127 margin: 0 auto;
128 border-collapse: collapse;
129 }
130 table td {
131 padding: 3px 20px;
132 border: 1px var(--table-border-color) solid;
133 }
134 table thead {
135 background: var(--table-header-bg);
136 }
137 table thead td {
138 font-weight: 700;
139 border: none;
140 }
141 table thead th {
142 padding: 3px 20px;
143 }
144 table thead tr {
145 border: 1px var(--table-header-bg) solid;
146 }
147 /* Alternate background colors for rows */
148 table tbody tr:nth-child(2n) {
149 background: var(--table-alternate-bg);
150 }
151
152
153 blockquote {
154 margin: 20px 0;
155 padding: 0 20px;
156 color: var(--fg);
157 background-color: var(--quote-bg);
158 border-block-start: .1em solid var(--quote-border);
159 border-block-end: .1em solid var(--quote-border);
160 }
161
162 /* TODO: Remove .warning in a future version of mdbook, it is replaced by
163 blockquote tags. */
164 .warning {
165 margin: 20px;
166 padding: 0 20px;
167 border-inline-start: 2px solid var(--warning-border);
168 }
169
170 .warning:before {
171 position: absolute;
172 width: 3rem;
173 height: 3rem;
174 margin-inline-start: calc(-1.5rem - 21px);
175 content: "ⓘ";
176 text-align: center;
177 background-color: var(--bg);
178 color: var(--warning-border);
179 font-weight: bold;
180 font-size: 2rem;
181 }
182
183 blockquote .warning:before {
184 background-color: var(--quote-bg);
185 }
186
187 kbd {
188 background-color: var(--table-border-color);
189 border-radius: 4px;
190 border: solid 1px var(--theme-popup-border);
191 box-shadow: inset 0 -1px 0 var(--theme-hover);
192 display: inline-block;
193 font-size: var(--code-font-size);
194 font-family: var(--mono-font);
195 line-height: 10px;
196 padding: 4px 5px;
197 vertical-align: middle;
198 }
199
200 sup {
201 /* Set the line-height for superscript and footnote references so that there
202 isn't an awkward space appearing above lines that contain the footnote.
203
204 See https://github.com/rust-lang/mdBook/pull/2443#discussion_r1813773583
205 for an explanation.
206 */
207 line-height: 0;
208 }
209
210 .footnote-definition {
211 font-size: 0.9em;
212 }
213 /* The default spacing for a list is a little too large. */
214 .footnote-definition ul,
215 .footnote-definition ol {
216 padding-left: 20px;
217 }
218 .footnote-definition > li {
219 /* Required to position the ::before target */
220 position: relative;
221 }
222 .footnote-definition > li:target {
223 scroll-margin-top: 50vh;
224 }
225 .footnote-reference:target {
226 scroll-margin-top: 50vh;
227 }
228 /* Draws a border around the footnote (including the marker) when it is selected.
229 TODO: If there are multiple linkbacks, highlight which one you just came
230 from so you know which one to click.
231 */
232 .footnote-definition > li:target::before {
233 border: 2px solid var(--footnote-highlight);
234 border-radius: 6px;
235 position: absolute;
236 top: -8px;
237 right: -8px;
238 bottom: -8px;
239 left: -32px;
240 pointer-events: none;
241 content: "";
242 }
243 /* Pulses the footnote reference so you can quickly see where you left off reading.
244 This could use some improvement.
245 */
246 @media not (prefers-reduced-motion) {
247 .footnote-reference:target {
248 animation: fn-highlight 0.8s;
249 border-radius: 2px;
250 }
251
252 @keyframes fn-highlight {
253 from {
254 background-color: var(--footnote-highlight);
255 }
256 }
257 }
258
259 .tooltiptext {
260 position: absolute;
261 visibility: hidden;
262 color: #fff;
263 background-color: #333;
264 transform: translateX(-50%); /* Center by moving tooltip 50% of its width left */
265 left: -8px; /* Half of the width of the icon */
266 top: -35px;
267 font-size: 0.8em;
268 text-align: center;
269 border-radius: 6px;
270 padding: 5px 8px;
271 margin: 5px;
272 z-index: 1000;
273 }
274 .tooltipped .tooltiptext {
275 visibility: visible;
276 }
277
278 .chapter li.part-title {
279 color: var(--sidebar-fg);
280 margin: 5px 0px;
281 font-weight: bold;
282 }
283
284 .result-no-output {
285 font-style: italic;
286 }
287
288 .fa-svg svg {
289 width: 1em;
290 height: 1em;
291 fill: currentColor;
292 margin-bottom: -0.1em;
293 }
294
295 dt {
296 font-weight: bold;
297 margin-top: 0.5em;
298 margin-bottom: 0.1em;
299 }
300
301 /* This uses a CSS counter to add numbers to definitions, but only if there is
302 more than one definition. */
303 dl, dt {
304 counter-reset: dd-counter;
305 }
306
307 /* When there is more than one definition, increment the counter. The first
308 selector selects the first definition, and the second one selects definitions
309 2 and beyond.*/
310 dd:has(+ dd), dd + dd {
311 counter-increment: dd-counter;
312 /* Use flex display to help with positioning the numbers when there is a p
313 tag inside the definition. */
314 display: flex;
315 align-items: flex-start;
316 }
317
318 /* Shows the counter for definitions. The first selector selects the first
319 definition, and the second one selections definitions 2 and beyond.*/
320 dd:has(+ dd)::before, dd + dd::before {
321 content: counter(dd-counter) ". ";
322 font-weight: 600;
323 display: inline-block;
324 margin-right: 0.5em;
325 }
326
327 dd > p {
328 /* For loose definitions that have a p tag inside, don't add a bunch of
329 space before the definition. */
330 margin-top: 0;
331 }
332
333 /* Remove some excess space from the bottom. */
334 .blockquote-tag p:last-child {
335 margin-bottom: 2px;
336 }
337
338 .blockquote-tag {
339 /* Add some padding to make the vertical bar a little taller than the text.*/
340 padding: 2px 0px 2px 20px;
341 /* Add a solid color bar on the left side. */
342 border-inline-start-style: solid;
343 border-inline-start-width: 4px;
344 /* Disable the background color from normal blockquotes . */
345 background-color: inherit;
346 /* Disable border blocks from blockquotes. */
347 border-block-start: none;
348 border-block-end: none;
349 }
350
351 .blockquote-tag-title svg {
352 fill: currentColor;
353 /* Add space between the icon and the title. */
354 margin-right: 8px;
355 }
356
357 .blockquote-tag-note {
358 border-inline-start-color: var(--blockquote-note-color);
359 }
360
361 .blockquote-tag-tip {
362 border-inline-start-color: var(--blockquote-tip-color);
363 }
364
365 .blockquote-tag-important {
366 border-inline-start-color: var(--blockquote-important-color);
367 }
368
369 .blockquote-tag-warning {
370 border-inline-start-color: var(--blockquote-warning-color);
371 }
372
373 .blockquote-tag-caution {
374 border-inline-start-color: var(--blockquote-caution-color);
375 }
376
377 .blockquote-tag-note > .blockquote-tag-title {
378 color: var(--blockquote-note-color);
379 }
380
381 .blockquote-tag-tip > .blockquote-tag-title {
382 color: var(--blockquote-tip-color);
383 }
384
385 .blockquote-tag-important > .blockquote-tag-title {
386 color: var(--blockquote-important-color);
387 }
388
389 .blockquote-tag-warning > .blockquote-tag-title {
390 color: var(--blockquote-warning-color);
391 }
392
393 .blockquote-tag-caution > .blockquote-tag-title {
394 color: var(--blockquote-caution-color);
395 }
396
397 .blockquote-tag-title {
398 /* Slightly increase the weight for more emphasis. */
399 font-weight: 600;
400 /* Vertically center the icon with the text. */
401 display: flex;
402 align-items: center;
403 /* Remove default large margins for a more compact display. */
404 margin: 2px 0 8px 0;
405 }
406
407 .blockquote-tag-title .fa-svg {
408 fill: currentColor;
409 /* Add some space between the icon and the text. */
410 margin-right: 8px;
411 }
412
413 /* All this code is to handle the "zoomable" images feature. */
414
415 /* This one makes the checkbox invisible while keeping it selectable with the keyboard (with the
416 "tab" key). */
417 .content .checkbox-img {
418 position: absolute;
419 width: 1px;
420 height: 1px;
421 padding: 0;
422 margin: -1px;
423 overflow: hidden;
424 clip: rect(0, 0, 0, 0);
425 white-space: nowrap;
426 border: 0;
427 }
428 /* When the input is focused, we make it appear to the user by adding an outline to the img
429 instead */
430 .content .checkbox-img:focus + img {
431 outline: auto;
432 }
433 /* The "zoomed-in" image is not displayed until the checkbox is "ticked". */
434 .content .checkbox-img:not(:checked) ~ .img-wrapper {
435 display: none;
436 }
437 .content .checkbox-label {
438 display: block;
439 max-width: 100%;
440 }
441 .content .checkbox-label img {
442 cursor: zoom-in;
443 }
444 .content .checkbox-img:checked ~ .img-wrapper {
445 position: fixed;
446 top: 0;
447 left: 0;
448 width: 100vw;
449 height: 100vh;
450 background-color: rgba(0, 0, 0, 0.4);
451 z-index: 1001;
452 display: flex;
453 align-items: center;
454 justify-content: center;
455 cursor: zoom-out;
456 }
457 .content .checkbox-img:checked ~ .img-wrapper > img {
458 --img-padding: 5px;
459 padding: var(--img-padding);
460 background: #999;
461 cursor: zoom-out;
462 max-width: calc(100% - (var(--img-padding) * 2));
463 max-height: calc(100% - (var(--img-padding) * 2));
464 }