1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
|
/**
* Global styling.
**/
* {
box-sizing: border-box;
}
:root {
--code-font: "Fira Mono", Menlo, "Roboto Mono", Consolas, monospace;
--sans-font: Helvetica, Arial, sans-serif;
--link-color-on-white: #0645ad;
--link-color-on-black: #accbff;
/* Colors from 2014 Material Design color palettes
(https://m2.material.io/design/color/the-color-system) */
--blue-800: #1565C0;
--deep-orange-500: #FF5722;
--deep-orange-700: #E64A19;
}
html {
/* Prevent font scaling in landscape while allowing user zoom */
-webkit-text-size-adjust: 100%;
}
body {
font-family: "Source Serif", Georgia, serif;
font-size: 17px;
line-height: 1.4;
}
body.has-js .no-js, body.no-js .has-js {
display: none !important;
}
/* Firefox allows the user to specify colors in the UA stylesheet, so set them
explicitly. */
body {
color: black;
background: white;
}
body.dark {
color: #eee;
background: black;
}
/**
* Top-level layout.
*
* There are two main elements: #navbar and #main. Both have a maximum
* width, and is centered when the viewport is wider than that.
**/
/* #navbar is wrapped by #navbar-container, a black stripe that always span
the entire viewport. */
#navbar-container {
width: 100%;
color: white;
background-color: #1a1a1a;
padding: 7px 0;
}
#navbar, #main {
/* Keep the content at 800px. */
max-width: 832px;
margin: auto;
padding: 0 16px;
}
/* 832px = max-width + left and right padding of #main.
After this screen width, #main will no longer get wider, but we allow
.extra-wide elements to continue to get wider up to 900px, using negative
left and right margins.
*/
@media screen and (min-width: 832px) {
.extra-wide {
/* 32px is left and right padding of #main. */
width: calc(min(100vw - 32px, 900px));
/* upper bound is calculated by substituting 100vw = 900px + 32px */
margin-inline: calc(max((832px - 100vw) / 2, -50px));
}
}
/**
* Elements in the navbar.
*
* The navbar is made up of two elements, #site-title and ul#nav-list. The
* latter contains <li>s, each of which contains an <a>.
*/
#site-title, #nav-list {
display: inline-block;
/* Add spacing between lines when the navbar cannot fit in one line. */
line-height: 1.4;
}
#site-title {
/* Move the title downward 1px so that it looks more aligned with the
* category list. */
position: relative;
top: 1px;
font-size: 1.2em;
font-family: var(--code-font);
}
#site-title {
color: #5b5;
}
#nav-list {
/* Override the margins for <ul> set below for content. */
margin: 0 0 0 0.8em;
}
#nav-list li {
list-style: none;
display: inline-block;
/* Override the margins for <li> set below for content. */
margin: 0 0 0 0.2em;
}
#nav-list li a {
color: white;
border-radius: 3px;
padding: 1px 0.4em;
font-family: var(--code-font);
}
#nav-list li a:hover {
background-color: #444;
}
#nav-list li a.current {
color: black;
background-color: white;
}
/* The sponsor nav item is styled somewhat specially, and shares a lot with the
sponsor button on the homepage. */
.sponsor::before {
font-family: "fa-elv-sh";
content: var(--icon-heart);
font-size: 0.9em;
font-weight: normal;
margin-top: -0.1em;
color: var(--deep-orange-500);
}
.button.sponsor::before {
padding-right: 0.3em;
}
/**
* Article header.
**/
.timestamp {
margin-bottom: 0.6em;
}
.article-title {
padding: 16px 0;
border-bottom: darkred solid 2px;
}
/* Unfortunately we use <h1> for both the article title and the first-level
section title, and the default h1 rule is for the latter. Override it. */
.article-title h1 {
font-size: 1.4em;
margin: 0;
padding: 0;
border: none;
}
/**
* Table of content.
*/
#toc-wrapper {
background-color: #f0f0f0;
margin: 0 0 16px 0;
border-radius: 6px;
line-height: 1;
}
.dark #toc-wrapper {
background-color: #181818;
}
#toc-header {
padding: 1em 1em 0.6em 1em;
border-bottom: solid white 2px;
cursor: pointer;
}
#toc-status {
display: inline-block;
width: 0;
height: 0;
margin-right: 2px;
border: 6px solid transparent;
position: relative;
}
/* Draw triangles in #toc-status using CSS. */
#toc-status:not(.closed) {
border-top: 6px solid black;
top: 3px;
}
#toc-status.closed {
border-left: 6px solid black;
left: 3px;
}
#toc {
margin-left: -0.6em;
padding: 1em;
}
@media screen and (min-width: 600px) {
#toc {
column-count: 2;
}
}
#toc ul {
/* The value set for <ul> in content is a bit too big for ToC */
margin-left: 1em;
}
#toc li {
list-style: none;
/* Keep first-level ToC within one column */
break-inside: avoid;
}
/* When the ToC has two columns, the first item of the second column will not
the intended top margin (this is how columns work in CSS). Work around this
by adding some extra top padding in #toc, and removing the top margin of the
very first <li> element to match. */
#toc > ul:first-child > li:first-child {
margin-top: 0;
}
/**
* Article content.
*
* Note: in the layout the table of content is part of div.article-content
* (because it's generated as part of the Markdown).
**/
.article-content {
padding-top: 32px;
}
/* We only use h1 to h3, so don't bother styling h4+. */
h1, h2, h3 {
line-height: 1.25;
margin-top: 32px;
margin-bottom: 12px;
font-weight: bold;
display: flex;
align-items: end;
}
h1 {
font-size: 1.3em;
/* Create a vertical bar 0.3em wide and 0.3em away to the left, and move the
text back to the original position. */
border-left: darkred solid 0.3em;
padding-left: 0.3em;
margin-left: -0.6em;
}
h2 {
font-size: 1.2em;
}
.api-comment {
margin-left: auto;
padding-left: 16px;
font-weight: normal;
font-size: 1rem;
}
p, ul, ol, pre {
/* Hardcode a pixel value since <pre> has a smaller font size. */
margin-bottom: 12px;
}
ul, ol {
margin-left: 1.5em;
}
li {
margin: 0.5em 0;
}
kbd {
display: inline-block;
border: 1px solid black;
border-radius: 3px;
padding: 0 3px;
margin: 1px;
font-size: 85%;
font-family: "Lucida Grande", Arial, sans-serif;
}
table {
border-collapse: collapse;
width: 100%;
margin-bottom: 16px;
}
td, th {
border: 1px solid #aaa;
text-align: left;
padding: 0.4em;
}
/* Make <ol>s inside table cells a bit more compact. This style is currently only
used for the list of instructions in get/default-shell.html, and likely needs
to be revised when more complex layouts arise (which may be never).
Safari seems to have a bug with certain (but not all) non-zero margin-top and
margin-bottom values inside table cells: the cell containing the <ol> will be
taller than other cells in the same row, causing their bottom border to
misalign. So we set them to 0 to be safe. It's probably some floating-point
error propagation issue. */
td ol li {
margin-top: 0;
margin-bottom: 0.15em;
}
td ol li:last-child, td ol {
margin-bottom: 0;
}
.dark td, .dark th {
border-color: #444;
}
td.notice {
text-align: center;
background-color: #ddd;
}
.dark td.notice {
background-color: #333;
}
/** Links. */
a {
text-decoration: none;
color: #0645ad;
}
#main a:not(.button):not(.anchor):hover {
text-decoration: underline;
}
.dark a {
color: var(--link-color-on-black);
}
a.anchor::before {
font-family: "fa-elv-sh";
content: var(--icon-link);
font-size: 0.9em;
font-weight: normal;
padding-left: 0.3em;
}
a.anchor {
opacity: 0; /* Hide by default */
color: inherit;
}
*:hover > a.anchor {
opacity: 1;
}
a[target="_blank"]::after {
font-family: "fa-elv-sh";
content: var(--icon-link-ext);
/* Set the icon some distance away. */
padding-left: 0.3em;
/* Make the icon slightly smaller and align it to the bottom.
For normal links we should be able to use "vertical-align: bottom", but
that doesn't work when the <a> is a flexbox (action buttons on the
homepage). */
font-size: 0.8em;
padding-top: 0.2em;
}
/**
* Code - inline code, block code and ttyshots.
*/
pre, code {
font-family: var(--code-font);
font-size: 0.85rem;
border-radius: 3px;
}
h1 code, h2 code, h3 code {
font-size: 0.8em;
padding: 0.1em 0.2em;
}
p code {
padding: 0.1em 0.5em;
background-color: #f0f0f0;
}
pre {
padding: 6px 10px;
border: 1px solid #bbbbbb;
background-color: white;
}
.dark code, .dark pre {
background-color: #181818;
}
/* Scroll just the <code>, not the <header>. */
pre code {
display: block;
overflow-x: auto;
}
pre.language-ttyshot, pre.language-ttyshot code {
/* Ttyshots often have right-justified elements (right prompt, vertical
scrollbar), so make it as wide as its content. */
width: fit-content;
max-width: 100%;
}
pre.language-ttyshot code {
/* Set the line height to be exactly equal to the height of the line box, so
that vertical bars in ttyshots don't have gaps.
According to MDN, the best practice is to use a dimensionless value
relative to the "font size", but unfortunately different browsers disagree
on exact which font dimension to use as the "font size". Since we fix the
font anyway, we can hardcode a pixel value.
16px is the maximal value that works for Chrome - 17px is fine for Safari
and Firefox but leads to gaps in Chrome. 18px leads to gaps on all three.
*/
line-height: 16px;
/* Unfortunately hardcoding line-height is still not sufficient, because
browsers also disagree on the height the font actually needs.
If the browser decides that the font needs more than 16px (which is the
case on Firefox 123), fixing line-height to 16px causes the content to
overflow vertically, causing a vertical scrollbar to be shown, which in
turn causes a horizontal scrollbar to be shown (because the vertical
scrollbar takes up some horizontal space, so the content now also overflows
horizontally). This works around that. */
overflow-y: hidden;
}
pre header {
font-family: var(--sans-font);
/* Cancel the top, left and right paddings of the <pre> and create a bit of
space between the header and the code. */
margin: -6px -10px 3px;
/* Replicate side paddings of the <pre>, and add appropriate top and bottom
paddings. */
padding: 4px 10px 3px;
background-color: #ddd;
color: black;
}
/* Set the fallback icon for the header and some common properties. */
pre header::before {
content: var(--icon-doc-text);
font-family: "fa-elv-sh";
padding-right: 6px;
speak: never;
}
pre header a {
color: var(--link-color-on-white);
}
.dark pre header a {
/* Overwrite color of ".dark a". */
color: var(--link-color-on-white);
}
/* md2html generates a <p> inside the <header>. */
pre header p {
display: inline;
}
pre.language-elvish header {
background-color: #ddeedd;
color: black;
}
pre.language-elvish header::before {
content: var(--icon-file-code);
}
pre[class^="language-"][class$="-transcript"] header, pre.language-ttyshot header {
background-color: #1a1a1a;
color: white;
}
pre[class^="language-"][class$="-transcript"] header a, pre.language-ttyshot header a {
color: var(--link-color-on-black);
}
pre[class^="language-"][class$="-transcript"] header::before, pre.language-ttyshot header::before {
content: var(--icon-terminal);
}
/**
* Category content.
**/
#main.category {
padding-top: 32px;
}
.article-list {
margin-left: 0;
list-style: none;
}
.article-list li {
/* A large left padding for the bullet list .*/
padding: 6px 8px 6px 30px;
margin: 0;
display: flex;
flex-wrap: wrap;
}
.article-list li:nth-child(even) {
background: #f6f6f6;
}
.dark .article-list li:nth-child(even) {
background: #181818;
}
.article-list li:nth-child(odd) {
background: #e8e8e8;
}
.dark .article-list li:nth-child(odd) {
background: #222;
}
.article-list li header::before {
/* Using a flexbox for the <li> loses the bullet. Recreate it and position it
within the left-padding . */
background-color: black;
border-radius: 4px;
content: " ";
width: 8px;
height: 8px;
position: absolute;
margin-left: -17px;
margin-top: 7px;
speak: never;
}
.dark .article-list li header::before {
background-color: white;
}
.article-list:nth-of-type(even) li header::before {
/* Use square bullets for every other article list. */
border-radius: 0px;
}
.article-list li time {
margin-left: auto;
padding-left: 16px;
}
/* Used on learn/ */
.new {
font-size: 0.8em;
font-weight: bold;
vertical-align: top;
color: red;
}
/**
* Layout utilities.
**/
.clear {
clear: both;
}
.no-display {
display: none !important;
}
|