CS224W Course Notes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

585 lines
14 KiB

  1. ---
  2. # this ensures Jekyll reads the file to be transformed into CSS later
  3. # only Main files contain this front matter, not partials.
  4. nav_exclude: true
  5. ---
  6. /*****************************************************************************/
  7. /* Tufte Jekyll blog theme
  8. /* - source: https://github.com/clayh53/tufte-jekyll
  9. /* - based on Tufte CSS by Dave Liepmann ( https://github.com/edwardtufte/tufte-css )
  10. /*****************************************************************************/
  11. // Imports to create final
  12. @import "../_sass/fonts";
  13. @import "../_sass/settings";
  14. @import "../_sass/syntax-highlighting";
  15. /* Changes from original tufte.css
  16. - use border-box instead of content-box for box-sizing
  17. - change font size as browser width expands or contracts
  18. - add MathJax styling
  19. - removes underline from <a> links and sets their color to $constrast-color, except for links that are inside <p>
  20. - uses marginnote for maincolumn figure caption
  21. */
  22. // global resets
  23. *, *:before, *:after {
  24. margin: 0;
  25. box-sizing: border-box;
  26. }
  27. html, body { height: 100%; }
  28. /* clearfix hack after Cederholm (group class name) */
  29. .group:after {
  30. content: "";
  31. display: table;
  32. clear: both;
  33. }
  34. // MathJax styling
  35. .mathblock, .MJXc-display {
  36. font-size: 1.5rem !important;
  37. clear: left;
  38. }
  39. // variable font size
  40. html {
  41. font-size: 11px;
  42. -webkit-font-smoothing: antialiased;
  43. -moz-osx-font-smoothing: grayscale;
  44. }
  45. @media screen and (min-width: 800px){ html{ font-size: 12px; } }
  46. @media screen and (min-width: 900px){ html{ font-size: 13px; } }
  47. @media screen and (min-width: 1000px){ html{ font-size: 14px; } }
  48. @media screen and (min-width: 1100px){ html{ font-size: 15px; } }
  49. body {
  50. width: 100%;
  51. padding-left: 12.5%;
  52. max-width: calc(12.5% + 1400px); // max-width of content box = 1400px
  53. margin: 0 auto;
  54. font-family: $body-font;
  55. background-color: $bg-color;
  56. color: $text-color;
  57. counter-reset: sidenote-counter;
  58. }
  59. // changed
  60. h1 {
  61. font-weight: 400;
  62. margin-top: 1.568rem;
  63. margin-bottom: 1.568rem;
  64. font-size: 2.5rem;
  65. line-height: 0.784;
  66. }
  67. h2 {
  68. font-style: italic;
  69. font-weight: 400;
  70. margin-top: 4rem; /* 2.1rem */
  71. margin-bottom: 1.4rem;
  72. font-size: 2.2rem;
  73. line-height: 1;
  74. }
  75. h3 {
  76. font-style: italic;
  77. font-weight: 400;
  78. font-size: 1.7rem;
  79. margin-top: 2rem;
  80. margin-bottom: 1.4rem;
  81. line-height: 1;
  82. }
  83. p.subtitle {
  84. font-style: italic;
  85. margin-top: 1rem;
  86. margin-bottom: 1rem;
  87. font-size: 1.8rem;
  88. display: block;
  89. line-height: 1;
  90. }
  91. article {
  92. width: 55%;
  93. padding: 5rem 0;
  94. }
  95. /* ==============================
  96. * Main Body Text
  97. * ============================== */
  98. p, ol, ul {
  99. font-size: 1.4rem;
  100. line-height: 2rem;
  101. margin: 1.4rem 0;
  102. }
  103. p {
  104. padding-right: 0;
  105. vertical-align: baseline;
  106. }
  107. li { margin-bottom: 0.5em; }
  108. blockquote p, pre { padding-right: 0 10%; }
  109. blockquote * { font-size: 1.1rem; }
  110. blockquote p { line-height: 1.75rem; }
  111. blockquote footer { text-align: right; }
  112. /* ==============================
  113. * Figures and Margins
  114. * ============================== */
  115. // the caption of a figure.maincolumn is never hidden
  116. figure.maincolumn { margin-bottom: 3em; }
  117. figure.maincolumn > figcaption { display: block !important; }
  118. figure.fullwidth figcaption {
  119. float: left;
  120. margin-right: 0%;
  121. margin-left: 36%;
  122. }
  123. img { max-width: 100%; }
  124. .sidenote, .marginnote {
  125. // goal: width = 50% of <p> (= 27.5% of 87.5% <body>)
  126. // - vw for constant width regardless of container
  127. // - 336.875px = 24.0625% of 1400px (max-width of <body>)
  128. width: 24.0625vw;
  129. max-width: 336.875px;
  130. // goal: 5.5vw of spacing between main column and sidebar
  131. // - assuming container has width of <article>, then
  132. // 10% (spacing) + 50% (width) = 60%
  133. margin-right: -60%;
  134. float: right;
  135. clear: right;
  136. font-size: 1rem;
  137. margin-top: 0;
  138. margin-bottom: 1.4rem;
  139. line-height: 1.4;
  140. vertical-align: baseline;
  141. position: relative;
  142. }
  143. .sidenote-number { counter-increment: sidenote-counter; }
  144. .sidenote-number:after, .sidenote:before {
  145. font-family: et-book-roman-old-style;
  146. color: $contrast-color; // added
  147. position: relative;
  148. vertical-align: baseline;
  149. }
  150. .sidenote-number:after {
  151. content: counter(sidenote-counter);
  152. font-size: 1rem;
  153. top: -0.5rem; // use top instead of vertical-align to avoid affecting line-height
  154. left: 0.1rem;
  155. }
  156. .sidenote:before {
  157. // unicode for a non-breaking space
  158. content: counter(sidenote-counter) ".\000a0";
  159. }
  160. // account for indentation of list items and blockquotes
  161. blockquote .sidenote, blockquote .marginnote {
  162. margin-right: -82.35%; // =70%/85%
  163. }
  164. li .sidenote, li .marginnote {
  165. margin-right: -63.29%; // not quite right yet
  166. }
  167. // margin toggle
  168. // - hide if screen is wide enough
  169. input.margin-toggle,
  170. label.margin-toggle:not(.sidenote-number) {
  171. display: none;
  172. }
  173. /* ==============================
  174. * Links
  175. * ============================== */
  176. // new link behavior
  177. a {
  178. color: $contrast-color;
  179. text-decoration: none;
  180. }
  181. /* Links: replicate underline that clears descenders */
  182. p > a:link, p > a:visited { color: inherit; }
  183. p > a:link {
  184. background: -webkit-linear-gradient(#fffff8, #fffff8), -webkit-linear-gradient(#fffff8, #fffff8), -webkit-linear-gradient(currentColor, currentColor);
  185. background: linear-gradient(#fffff8, #fffff8), linear-gradient(#fffff8, #fffff8), linear-gradient(currentColor, currentColor);
  186. -webkit-background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
  187. -moz-background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
  188. background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
  189. background-repeat: no-repeat, no-repeat, repeat-x;
  190. text-shadow: 0.03em 0 #fffff8, -0.03em 0 #fffff8, 0 0.03em #fffff8, 0 -0.03em #fffff8, 0.06em 0 #fffff8, -0.06em 0 #fffff8, 0.09em 0 #fffff8, -0.09em 0 #fffff8, 0.12em 0 #fffff8, -0.12em 0 #fffff8, 0.15em 0 #fffff8, -0.15em 0 #fffff8;
  191. background-position: 0% 93%, 100% 93%, 0% 93%;
  192. }
  193. @media screen and (-webkit-min-device-pixel-ratio: 0) {
  194. p > a:link {
  195. background-position-y: 87%, 87%, 87%;
  196. }
  197. }
  198. p > a:link::selection,
  199. p > a:link::-moz-selection {
  200. text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
  201. background: #b4d5fe;
  202. }
  203. /* ==============================
  204. * Code
  205. * ============================== */
  206. // Markdown code blocks (```, ~~~, or indented blocks) are always <pre><code></code></pre>
  207. // Markdown code spans (`, ``) are always <p><code></code></p>
  208. pre, code {
  209. font-family: $code-font;
  210. font-size: 1rem;
  211. line-height: 1.42;
  212. margin-top: 1.42rem;
  213. -webkit-text-size-adjust: 100%; /* Prevent adjustments of font size after orientation changes in iOS. See https://github.com/edwardtufte/tufte-css/issues/81#issuecomment-261953409 */ }
  214. pre { overflow-x: auto; }
  215. /* ==============================
  216. * Miscellaneous
  217. * ============================== */
  218. .sans {
  219. font-family: $sans-font;
  220. letter-spacing: .03em;
  221. }
  222. .fullwidth { max-width: 90%; }
  223. .full-width {
  224. .sidenote, .sidenote-number, .marginnote {
  225. display: none;
  226. }
  227. }
  228. span.newthought {
  229. font-variant: small-caps;
  230. font-size: 1.2em;
  231. letter-spacing: 0.05rem;
  232. } // added
  233. // helper classes
  234. .contrast { color: $contrast-color; }
  235. .smaller { font-size: 80%; }
  236. hr.slender {
  237. border: 0;
  238. height: 1px;
  239. margin-top: 1.4rem;
  240. margin-bottom:1.4rem;
  241. background-image: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
  242. background-image: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
  243. background-image: -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
  244. background-image: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
  245. }
  246. /* ==============================
  247. * Tables
  248. * ============================== */
  249. // Use booktabs style as default for all tables, including Markdown tables
  250. table, table.booktabs {
  251. width: auto;
  252. margin: 0 auto;
  253. border-spacing: 0px;
  254. border-top: 2px solid $border-color;
  255. border-bottom: 2px solid $border-color;
  256. }
  257. th, .booktabs th {
  258. border-bottom: 1px solid $border-color;
  259. padding: 0.65ex 0.5em 0.4ex 0.5em;
  260. font-weight: normal;
  261. text-align: center;
  262. }
  263. th, td {
  264. font-size: 1.2rem;
  265. line-height: 1.71428571;
  266. }
  267. th, .booktabs th.cmid {
  268. border-bottom: 1px solid lighten($border-color, 25%);
  269. }
  270. .booktabs th.nocmid {
  271. border-bottom: none;
  272. }
  273. // add space between thead row and tbody
  274. tr:first-child td, .booktabs tbody tr:first-child td {
  275. padding-top: 0.65ex;
  276. }
  277. td, .booktabs td {
  278. padding-left: 0.5em;
  279. padding-right: 0.5em;
  280. text-align: left;
  281. }
  282. caption, .booktabs caption {
  283. font-size: 90%;
  284. text-align: left;
  285. width: auto;
  286. margin-left: auto;
  287. margin-right: auto;
  288. margin-top: 1ex;
  289. caption-side: top;
  290. }
  291. .booktabs tbody tr td.l { text-align: left !important; }
  292. .booktabs tbody tr td.c { text-align: center !important; }
  293. .booktabs tbody tr td.r { text-align: right !important; }
  294. .table-caption {
  295. float: right;
  296. clear: right;
  297. margin-right: -60%;
  298. width: 50%;
  299. margin-top: 0;
  300. margin-bottom: 0;
  301. font-size: 1.0rem;
  302. line-height: 1.96;
  303. }
  304. /* ==============================
  305. * Small Screens
  306. * ============================== */
  307. @media (max-width: 760px) {
  308. article {
  309. width: 90%;
  310. }
  311. figure {
  312. max-width: 90%;
  313. }
  314. figcaption, figure.fullwidth figcaption {
  315. margin-right: 0%;
  316. max-width: none;
  317. }
  318. blockquote p, blockquote footer {
  319. padding-right: 10%;
  320. }
  321. label.margin-toggle:not(.sidenote-number) {
  322. display: inline;
  323. color: $contrast-color;
  324. }
  325. blockquote .sidenote,
  326. blockquote .marginnote,
  327. li .sidenote,
  328. li .marginnote,
  329. .sidenote,
  330. .marginnote {
  331. // treat as-if inline
  332. width: 100%;
  333. max-width: 100%;
  334. display: none;
  335. float: left;
  336. padding: 0 5%;
  337. margin: 1rem 0;
  338. vertical-align: baseline;
  339. }
  340. .margin-toggle:checked + .sidenote,
  341. .margin-toggle:checked + .marginnote {
  342. display: block;
  343. }
  344. label {
  345. cursor: pointer;
  346. }
  347. .table-caption {
  348. display: block;
  349. float: right;
  350. clear: both;
  351. width: 98%;
  352. margin-top: 1rem;
  353. margin-bottom: 0.5rem;
  354. margin-left: 1%;
  355. margin-right: 1%;
  356. vertical-align: baseline;
  357. position: relative;
  358. }
  359. div.table-wrapper,
  360. table,
  361. table.booktabs {
  362. width: 85%;
  363. }
  364. }
  365. /* ==============================
  366. * Nav and Footer Styling
  367. * ============================== */
  368. header > nav.group, body footer {
  369. width: 95%;
  370. padding-top: 2rem;
  371. }
  372. // escaped unicode for the carats and then a space on active menu links
  373. nav.group a.active:before{
  374. content:"\0003c\000a0";
  375. }
  376. nav.group a.active:after{
  377. content:"\000a0\0003e";
  378. }
  379. header > nav a {
  380. font-size: 1.2rem;
  381. font-family: $sans-font;
  382. letter-spacing: 0.15em;
  383. text-transform: uppercase;
  384. color: $contrast-color;
  385. padding-top: 1.5rem;
  386. display: inline-block;
  387. float: left;
  388. margin-top: 0;
  389. margin-bottom: 0;
  390. padding-right: 2rem;
  391. vertical-align: baseline;
  392. }
  393. ul.footer-links, .credits {
  394. list-style: none;
  395. text-align: center;
  396. margin: 0 auto;
  397. }
  398. ul.footer-links li {
  399. display: inline;
  400. padding: 0.5rem 0.25rem;
  401. }
  402. .credits {
  403. padding: 1rem 0rem;
  404. }
  405. // change font color for credit links in footer
  406. .credits{
  407. font-family: $sans-font;
  408. & a {
  409. color: $contrast-color;
  410. }
  411. }
  412. /* ==============================
  413. * Full-width page styling
  414. * ============================== */
  415. body.full-width {
  416. width: 90%;
  417. padding: 0 5%;
  418. }
  419. .full-width article p {
  420. width: 90%;
  421. }
  422. /* ==============================
  423. * @media print / screen
  424. * ============================== */
  425. // do not display a print-footer for screen display
  426. @media screen {
  427. .print-footer{ display: none; }
  428. }
  429. @media print {
  430. *, *:before, *:after {
  431. background: transparent !important;
  432. color: #000 !important; // Black prints faster
  433. box-shadow: none !important;
  434. text-shadow: none !important;
  435. }
  436. @page {
  437. margin: 0.75in 0.5in 0.75in 0.5in;
  438. orphans: 4;
  439. widows: 2;
  440. }
  441. body {
  442. font-size: 12pt;
  443. padding-left: 5%;
  444. max-width: calc(5% + 1400px); // max-width of content box = 1400px
  445. }
  446. article {
  447. padding: 0;
  448. }
  449. /* this only applies when @media width > 760px */
  450. .sidenote, .marginnote {
  451. // goal: width = 50% of <p> (= 27.5% of 95% <body>)
  452. // - vw for constant width regardless of container
  453. // - 365.75px = 26.125% of 1400px (max-width of <body>)
  454. width: 26.125vw;
  455. max-width: 365.75px;
  456. }
  457. html body span.print-footer {
  458. font-family: $sans-font;
  459. font-size: 9pt;
  460. margin-top: 22.4pt;
  461. padding-top: 4pt;
  462. border-top: 1px solid #000;
  463. }
  464. thead {
  465. display: table-header-group;
  466. }
  467. tr,
  468. img {
  469. break-inside: avoid;
  470. }
  471. article h2, article h2 h3, article h3, article h3 h4, article h4, article h4 h5 {
  472. break-after: avoid;
  473. }
  474. body header, body footer {
  475. display: none;
  476. }
  477. }
  478. @media print and (max-width: 760px) {
  479. blockquote .sidenote,
  480. blockquote .marginnote,
  481. li .sidenote,
  482. li .marginnote,
  483. .sidenote,
  484. .marginnote {
  485. // treat as-if inline
  486. width: 100%;
  487. max-width: 100%;
  488. display: block;
  489. }
  490. }