_typography.scss 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. $base-font-size: 22px !default;
  2. $font-family-default: serif !default;
  3. $font-family-headings: sans-serif !default;
  4. $font-family-code: monospace !default;
  5. $leading: 1.5rem;
  6. html { font-family: $font-family-default; font-size: $base-font-size }
  7. // -webkit-font-smoothing: antialiased; // only if background darker than font
  8. // text-size-adjust: auto; // WIP; check http://caniuse.com
  9. p {
  10. margin: $leading/2 0 0;
  11. padding: 0;
  12. line-height: $leading;
  13. }
  14. dl,
  15. ul,
  16. ol {
  17. margin: $leading 0;
  18. padding: 0;
  19. li {
  20. margin: 0;
  21. padding: 0;
  22. line-height: $leading;
  23. }
  24. dl,
  25. ul,
  26. ol { margin: 0; } // font-size: 90%
  27. }
  28. ol { list-style: decimal; margin: 1.5rem }
  29. ul { list-style: none }
  30. blockquote {
  31. margin: $leading 0;
  32. padding: 0;
  33. line-height: $leading;
  34. }
  35. h1,
  36. h2,
  37. h3,
  38. h4,
  39. h5,
  40. h6 {
  41. font-family: $font-family-headings;
  42. margin: $leading 0 0;
  43. padding: 0;
  44. line-height: $leading;
  45. font-size: 100%;
  46. font-weight: normal;
  47. }
  48. h1 {
  49. font-size: 2.5rem;
  50. line-height: 2 * $leading;
  51. margin-top: 2 * $leading;
  52. }
  53. h2 {
  54. font-size: 2.25rem;
  55. line-height: 1.7 * $leading;
  56. margin-top: 1.7 * $leading;
  57. }
  58. h3 {
  59. font-size: 2rem;
  60. line-height: 1.5 * $leading;
  61. margin-top: 1.5 * $leading;
  62. }
  63. h4 { font-size: 1.6875rem }
  64. h5 { font-size: 1.43rem }
  65. h6 { font-size: 1.2rem }
  66. table {
  67. margin-top: $leading;
  68. border-spacing: 0px;
  69. border-collapse: collapse;
  70. }
  71. td,
  72. th { padding: 0; line-height: $leading }
  73. pre,
  74. code { font-family: $font-family-code }
  75. code {
  76. vertical-align: bottom; // Force code line height. Not ideal, but works.
  77. padding: 1px 2px;
  78. border-radius: .4rem;
  79. white-space: nowrap;
  80. }
  81. pre {
  82. padding: 0;
  83. overflow-x: scroll;
  84. overflow-y: hidden;
  85. > code {
  86. border: 0;
  87. padding: 0;
  88. border-radius: 0;
  89. white-space: pre;
  90. table { margin: 0 }
  91. }
  92. }
  93. /* Leading paragraph text */
  94. .lead { font-size: 1.2rem }
  95. /* Hug the block above you */
  96. .hug { margin-top: 0 }
  97. // To change font calcs use:
  98. // https://websemantics.uk/tools/responsive-font-calculator/
  99. /* 1rem(16px) @ 20rem(320px) -> 2rem(32px) @ 120rem(1920px) */
  100. @media (min-width: 20rem) {
  101. :root { font-size: calc(1rem + ((1vw - 0.2rem) * 1)) }
  102. }
  103. @media (min-width: 120rem) {
  104. :root { font-size: 1.7rem }
  105. }