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.

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