| 1 | /* |
|---|
| 2 | Buttondown |
|---|
| 3 | A Markdown/MultiMarkdown/Pandoc HTML output CSS stylesheet |
|---|
| 4 | Author: Ryan Gray |
|---|
| 5 | Date: 15 Feb 2011 |
|---|
| 6 | Revised: 21 Feb 2012 |
|---|
| 7 | |
|---|
| 8 | General style is clean, with minimal re-definition of the defaults or |
|---|
| 9 | overrides of user font settings. The body text and header styles are |
|---|
| 10 | left alone except title, author and date classes are centered. A Pandoc TOC |
|---|
| 11 | is not printed, URLs are printed after hyperlinks in parentheses. |
|---|
| 12 | Block quotes are italicized. Tables are lightly styled with lines above |
|---|
| 13 | and below the table and below the header with a boldface header. Code |
|---|
| 14 | blocks are line wrapped. |
|---|
| 15 | |
|---|
| 16 | All elements that Pandoc and MultiMarkdown use should be listed here, even |
|---|
| 17 | if the style is empty so you can easily add styling to anything. |
|---|
| 18 | |
|---|
| 19 | There are some elements in here for HTML5 output of Pandoc, but I have not |
|---|
| 20 | gotten around to testing that yet. |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | /* NOTES: |
|---|
| 24 | |
|---|
| 25 | Stuff tried and failed: |
|---|
| 26 | |
|---|
| 27 | It seems that specifying font-family:serif in Safari will always use |
|---|
| 28 | Times New Roman rather than the user's preferences setting. |
|---|
| 29 | |
|---|
| 30 | Making the font size different or a fixed value for print in case the screen |
|---|
| 31 | font size is making the print font too big: Making font-size different for |
|---|
| 32 | print than for screen causes horizontal lines to disappear in math when using |
|---|
| 33 | MathJax under Safari. |
|---|
| 34 | */ |
|---|
| 35 | |
|---|
| 36 | /* ---- Front Matter ---- */ |
|---|
| 37 | |
|---|
| 38 | /* Pandoc header DIV. Contains .title, .author and .date. Comes before div#TOC. |
|---|
| 39 | Only appears if one of those three are in the document. |
|---|
| 40 | */ |
|---|
| 41 | |
|---|
| 42 | div#header, header |
|---|
| 43 | { |
|---|
| 44 | /* Put border on bottom. Separates it from TOC or body that comes after it. */ |
|---|
| 45 | border-bottom: 1px solid #aaa; |
|---|
| 46 | margin-bottom: 0.5em; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | .title /* Pandoc title header (h1.title) */ |
|---|
| 50 | { |
|---|
| 51 | text-align: center; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | .author, .date /* Pandoc author(s) and date headers (h2.author and h3.date) */ |
|---|
| 55 | { |
|---|
| 56 | text-align: center; |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | /* Pandoc table of contents DIV when using the --toc option. |
|---|
| 60 | NOTE: this doesn't support Pandoc's --id-prefix option for #TOC and #header. |
|---|
| 61 | Probably would need to use div[id$='TOC'] and div[id$='header'] as selectors. |
|---|
| 62 | */ |
|---|
| 63 | |
|---|
| 64 | div#TOC, nav#TOC |
|---|
| 65 | { |
|---|
| 66 | /* Put border on bottom to separate it from body. */ |
|---|
| 67 | border-bottom: 1px solid #aaa; |
|---|
| 68 | margin-bottom: 0.5em; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | @media print |
|---|
| 72 | { |
|---|
| 73 | div#TOC, nav#TOC |
|---|
| 74 | { |
|---|
| 75 | /* Don't display TOC in print */ |
|---|
| 76 | display: none; |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | /* ---- Headers and sections ---- */ |
|---|
| 81 | |
|---|
| 82 | h1, h2, h3, h4, h5, h6 |
|---|
| 83 | { |
|---|
| 84 | font-family: "Helvetica Neue", Helvetica, "Liberation Sans", Calibri, Arial, sans-serif; /* Sans-serif headers */ |
|---|
| 85 | |
|---|
| 86 | /* font-family: "Liberation Serif", "Georgia", "Times New Roman", serif; /* Serif headers */ |
|---|
| 87 | |
|---|
| 88 | page-break-after: avoid; /* Firefox, Chrome, and Safari do not support the property value "avoid" */ |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | /* Pandoc with --section-divs option */ |
|---|
| 92 | |
|---|
| 93 | div div, section section /* Nested sections */ |
|---|
| 94 | { |
|---|
| 95 | margin-left: 2em; /* This will increasingly indent nested header sections */ |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | p {} |
|---|
| 99 | |
|---|
| 100 | blockquote |
|---|
| 101 | { |
|---|
| 102 | font-style: italic; |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | li /* All list items */ |
|---|
| 106 | { |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | li > p /* Loosely spaced list item */ |
|---|
| 110 | { |
|---|
| 111 | margin-top: 1em; /* IE: lack of space above a <li> when the item is inside a <p> */ |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | ul /* Whole unordered list */ |
|---|
| 115 | { |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | ul li /* Unordered list item */ |
|---|
| 119 | { |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | ol /* Whole ordered list */ |
|---|
| 123 | { |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | ol li /* Ordered list item */ |
|---|
| 127 | { |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | hr {} |
|---|
| 131 | |
|---|
| 132 | /* ---- Some span elements --- */ |
|---|
| 133 | |
|---|
| 134 | sub /* Subscripts. Pandoc: H~2~O */ |
|---|
| 135 | { |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | sup /* Superscripts. Pandoc: The 2^nd^ try. */ |
|---|
| 139 | { |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | em /* Emphasis. Markdown: *emphasis* or _emphasis_ */ |
|---|
| 143 | { |
|---|
| 144 | } |
|---|
| 145 | |
|---|
| 146 | em > em /* Emphasis within emphasis: *This is all *emphasized* except that* */ |
|---|
| 147 | { |
|---|
| 148 | font-style: normal; |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | strong /* Markdown **strong** or __strong__ */ |
|---|
| 152 | { |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | /* ---- Links (anchors) ---- */ |
|---|
| 156 | |
|---|
| 157 | a /* All links */ |
|---|
| 158 | { |
|---|
| 159 | /* Keep links clean. On screen, they are colored; in print, they do nothing anyway. */ |
|---|
| 160 | text-decoration: none; |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | @media screen |
|---|
| 164 | { |
|---|
| 165 | a:hover |
|---|
| 166 | { |
|---|
| 167 | /* On hover, we indicate a bit more that it is a link. */ |
|---|
| 168 | text-decoration: underline; |
|---|
| 169 | } |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | @media print |
|---|
| 173 | { |
|---|
| 174 | a { |
|---|
| 175 | /* In print, a colored link is useless, so un-style it. */ |
|---|
| 176 | color: black; |
|---|
| 177 | background: transparent; |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | a[href^="http://"]:after, a[href^="https://"]:after |
|---|
| 181 | { |
|---|
| 182 | /* However, links that go somewhere else, might be useful to the reader, |
|---|
| 183 | so for http and https links, print the URL after what was the link |
|---|
| 184 | text in parens |
|---|
| 185 | */ |
|---|
| 186 | content: " (" attr(href) ") "; |
|---|
| 187 | font-size: 90%; |
|---|
| 188 | } |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | /* ---- Images ---- */ |
|---|
| 192 | |
|---|
| 193 | img |
|---|
| 194 | { |
|---|
| 195 | /* Let it be inline left/right where it wants to be, but verticality make |
|---|
| 196 | it in the middle to look nicer, but opinions differ, and if in a multi-line |
|---|
| 197 | paragraph, it might not be so great. |
|---|
| 198 | */ |
|---|
| 199 | vertical-align: middle; |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | div.figure /* Pandoc figure-style image */ |
|---|
| 203 | { |
|---|
| 204 | /* Center the image and caption */ |
|---|
| 205 | margin-left: auto; |
|---|
| 206 | margin-right: auto; |
|---|
| 207 | text-align: center; |
|---|
| 208 | font-style: italic; |
|---|
| 209 | } |
|---|
| 210 | |
|---|
| 211 | p.caption /* Pandoc figure-style caption within div.figure */ |
|---|
| 212 | { |
|---|
| 213 | /* Inherits div.figure props by default */ |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | /* ---- Code blocks and spans ---- */ |
|---|
| 217 | |
|---|
| 218 | pre, code |
|---|
| 219 | { |
|---|
| 220 | background-color: #fdf7ee; |
|---|
| 221 | /* BEGIN word wrap */ |
|---|
| 222 | /* Need all the following to word wrap instead of scroll box */ |
|---|
| 223 | /* This will override the overflow:auto if present */ |
|---|
| 224 | white-space: pre-wrap; /* css-3 */ |
|---|
| 225 | white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ |
|---|
| 226 | white-space: -pre-wrap; /* Opera 4-6 */ |
|---|
| 227 | white-space: -o-pre-wrap; /* Opera 7 */ |
|---|
| 228 | word-wrap: break-word; /* Internet Explorer 5.5+ */ |
|---|
| 229 | /* END word wrap */ |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | pre /* Code blocks */ |
|---|
| 233 | { |
|---|
| 234 | /* Distinguish pre blocks from other text by more than the font with a background tint. */ |
|---|
| 235 | padding: 0.5em; /* Since we have a background color */ |
|---|
| 236 | border-radius: 5px; /* Softens it */ |
|---|
| 237 | /* Give it a some definition */ |
|---|
| 238 | border: 1px solid #aaa; |
|---|
| 239 | /* Set it off left and right, seems to look a bit nicer when we have a background */ |
|---|
| 240 | margin-left: 0.5em; |
|---|
| 241 | margin-right: 0.5em; |
|---|
| 242 | } |
|---|
| 243 | |
|---|
| 244 | @media screen |
|---|
| 245 | { |
|---|
| 246 | pre |
|---|
| 247 | { |
|---|
| 248 | /* On screen, use an auto scroll box for long lines, unless word-wrap is enabled */ |
|---|
| 249 | white-space: pre; |
|---|
| 250 | overflow: auto; |
|---|
| 251 | /* Dotted looks better on screen and solid seems to print better. */ |
|---|
| 252 | border: 1px dotted #777; |
|---|
| 253 | } |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | code /* All inline code spans */ |
|---|
| 257 | { |
|---|
| 258 | } |
|---|
| 259 | |
|---|
| 260 | p > code, li > code /* Code spans in paragraphs and tight lists */ |
|---|
| 261 | { |
|---|
| 262 | /* Pad a little from adjacent text */ |
|---|
| 263 | padding-left: 2px; |
|---|
| 264 | padding-right: 2px; |
|---|
| 265 | } |
|---|
| 266 | |
|---|
| 267 | li > p code /* Code span in a loose list */ |
|---|
| 268 | { |
|---|
| 269 | /* We have room for some more background color above and below */ |
|---|
| 270 | padding: 2px; |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | /* ---- Math ---- */ |
|---|
| 274 | |
|---|
| 275 | span.math /* Pandoc inline math default and --jsmath inline math */ |
|---|
| 276 | { |
|---|
| 277 | /* Tried font-style:italic here, and it messed up MathJax rendering in some browsers. Maybe don't mess with at all. */ |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | div.math /* Pandoc --jsmath display math */ |
|---|
| 281 | { |
|---|
| 282 | } |
|---|
| 283 | |
|---|
| 284 | span.LaTeX /* Pandoc --latexmathml math */ |
|---|
| 285 | { |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | eq /* Pandoc --gladtex math */ |
|---|
| 289 | { |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | /* ---- Tables ---- */ |
|---|
| 293 | |
|---|
| 294 | /* A clean textbook-like style with horizontal lines above and below and under |
|---|
| 295 | the header. Rows highlight on hover to help scanning the table on screen. |
|---|
| 296 | */ |
|---|
| 297 | |
|---|
| 298 | table |
|---|
| 299 | { |
|---|
| 300 | border-collapse: collapse; |
|---|
| 301 | border-spacing: 0; /* IE 6 */ |
|---|
| 302 | |
|---|
| 303 | border-bottom: 2pt solid #000; |
|---|
| 304 | border-top: 2pt solid #000; /* The caption on top will not have a bottom-border */ |
|---|
| 305 | |
|---|
| 306 | /* Center */ |
|---|
| 307 | margin-left: auto; |
|---|
| 308 | margin-right: auto; |
|---|
| 309 | } |
|---|
| 310 | |
|---|
| 311 | thead /* Entire table header */ |
|---|
| 312 | { |
|---|
| 313 | border-bottom: 1pt solid #000; |
|---|
| 314 | background-color: #eee; /* Does this BG print well? */ |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | tr.header /* Each header row */ |
|---|
| 318 | { |
|---|
| 319 | } |
|---|
| 320 | |
|---|
| 321 | tbody /* Entire table body */ |
|---|
| 322 | { |
|---|
| 323 | } |
|---|
| 324 | |
|---|
| 325 | /* Table body rows */ |
|---|
| 326 | |
|---|
| 327 | tr { |
|---|
| 328 | } |
|---|
| 329 | tr.odd:hover, tr.even:hover /* Use .odd and .even classes to avoid styling rows in other tables */ |
|---|
| 330 | { |
|---|
| 331 | background-color: #eee; |
|---|
| 332 | } |
|---|
| 333 | |
|---|
| 334 | /* Odd and even rows */ |
|---|
| 335 | tr.odd {} |
|---|
| 336 | tr.even {} |
|---|
| 337 | |
|---|
| 338 | td, th /* Table cells and table header cells */ |
|---|
| 339 | { |
|---|
| 340 | vertical-align: top; /* Word */ |
|---|
| 341 | vertical-align: baseline; /* Others */ |
|---|
| 342 | padding-left: 0.5em; |
|---|
| 343 | padding-right: 0.5em; |
|---|
| 344 | padding-top: 0.2em; |
|---|
| 345 | padding-bottom: 0.2em; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | /* Removes padding on left and right of table for a tight look. Good if thead has no background color*/ |
|---|
| 349 | /* |
|---|
| 350 | tr td:last-child, tr th:last-child |
|---|
| 351 | { |
|---|
| 352 | padding-right: 0; |
|---|
| 353 | } |
|---|
| 354 | tr td:first-child, tr th:first-child |
|---|
| 355 | { |
|---|
| 356 | padding-left: 0; |
|---|
| 357 | } |
|---|
| 358 | */ |
|---|
| 359 | |
|---|
| 360 | th /* Table header cells */ |
|---|
| 361 | { |
|---|
| 362 | font-weight: bold; |
|---|
| 363 | } |
|---|
| 364 | |
|---|
| 365 | tfoot /* Table footer (what appears here if caption is on top?) */ |
|---|
| 366 | { |
|---|
| 367 | } |
|---|
| 368 | |
|---|
| 369 | caption /* This is for a table caption tag, not the p.caption Pandoc uses in a div.figure */ |
|---|
| 370 | { |
|---|
| 371 | caption-side: top; |
|---|
| 372 | border: none; |
|---|
| 373 | font-size: 0.9em; |
|---|
| 374 | font-style: italic; |
|---|
| 375 | text-align: center; |
|---|
| 376 | margin-bottom: 0.3em; /* Good for when on top */ |
|---|
| 377 | padding-bottom: 0.2em; |
|---|
| 378 | } |
|---|
| 379 | |
|---|
| 380 | /* ---- Definition lists ---- */ |
|---|
| 381 | |
|---|
| 382 | dl /* The whole list */ |
|---|
| 383 | { |
|---|
| 384 | border-top: 2pt solid black; |
|---|
| 385 | padding-top: 0.5em; |
|---|
| 386 | border-bottom: 2pt solid black; |
|---|
| 387 | } |
|---|
| 388 | |
|---|
| 389 | dt /* Definition term */ |
|---|
| 390 | { |
|---|
| 391 | font-weight: bold; |
|---|
| 392 | } |
|---|
| 393 | |
|---|
| 394 | dd+dt /* 2nd or greater term in the list */ |
|---|
| 395 | { |
|---|
| 396 | border-top: 1pt solid black; |
|---|
| 397 | padding-top: 0.5em; |
|---|
| 398 | } |
|---|
| 399 | |
|---|
| 400 | dd /* A definition */ |
|---|
| 401 | { |
|---|
| 402 | margin-bottom: 0.5em; |
|---|
| 403 | } |
|---|
| 404 | |
|---|
| 405 | dd+dd /* 2nd or greater definition of a term */ |
|---|
| 406 | { |
|---|
| 407 | border-top: 1px solid black; /* To separate multiple definitions */ |
|---|
| 408 | } |
|---|
| 409 | |
|---|
| 410 | /* ---- Footnotes ---- */ |
|---|
| 411 | |
|---|
| 412 | a.footnote, a.footnoteRef { /* Pandoc, MultiMarkdown footnote links */ |
|---|
| 413 | font-size: small; |
|---|
| 414 | vertical-align: text-top; |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | a[href^="#fnref"], a.reversefootnote /* Pandoc, MultiMarkdown, ?? footnote back links */ |
|---|
| 418 | { |
|---|
| 419 | } |
|---|
| 420 | |
|---|
| 421 | @media print |
|---|
| 422 | { |
|---|
| 423 | a[href^="#fnref"], a.reversefootnote /* Pandoc, MultiMarkdown */ |
|---|
| 424 | { |
|---|
| 425 | /* Don't display these at all in print since the arrow is only something to click on */ |
|---|
| 426 | display: none; |
|---|
| 427 | } |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | div.footnotes /* Pandoc footnotes div at end of the document */ |
|---|
| 431 | { |
|---|
| 432 | } |
|---|
| 433 | |
|---|
| 434 | div.footnotes li[id^="fn"] /* A footnote item within that div */ |
|---|
| 435 | { |
|---|
| 436 | } |
|---|
| 437 | |
|---|
| 438 | /* You can class stuff as "noprint" to not print. |
|---|
| 439 | Useful since you can't set this media conditional inside an HTML element's |
|---|
| 440 | style attribute (I think), and you don't want to make another stylesheet that |
|---|
| 441 | imports this one and adds a class just to do this. |
|---|
| 442 | */ |
|---|
| 443 | |
|---|
| 444 | @media print |
|---|
| 445 | { |
|---|
| 446 | .noprint |
|---|
| 447 | { |
|---|
| 448 | display:none; |
|---|
| 449 | } |
|---|
| 450 | } |
|---|