typography-helpers.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. ---
  2. title: Typography helpers
  3. layout: documentation
  4. doc-tab: modifiers
  5. doc-subtab: typography-helpers
  6. breadcrumb:
  7. - home
  8. - documentation
  9. - modifiers
  10. - modifiers-typography-helpers
  11. ---
  12. {% assign initial_vars = site.data.variables.utilities.initial-variables.by_name %}
  13. {% assign sizes = site.data.variables.utilities.derived-variables.by_name['$sizes'].value | split: ' ' %}
  14. {% capture thead %}
  15. <thead>
  16. <tr>
  17. <th>
  18. Class
  19. </th>
  20. {% for breakpoint_hash in site.data.breakpoints %}
  21. {% assign breakpoint = breakpoint_hash[1] %}
  22. <th>
  23. {{ breakpoint.name }}<br>
  24. {% if breakpoint.id == 'mobile' %}
  25. Up to <code>{{ breakpoint.to }}px</code>
  26. {% elsif breakpoint.id == 'fullhd' %}
  27. <code>{{ breakpoint.from }}px</code> and above
  28. {% else %}
  29. Between <code>{{ breakpoint.from }}px</code> and <code>{{ breakpoint.to }}px</code>
  30. {% endif %}
  31. </th>
  32. {% endfor %}
  33. </tr>
  34. </thead>
  35. {% endcapture %}
  36. {% capture size1 %}
  37. <td class="is-narrow">
  38. <p class="notification is-primary"><code>{{ initial_vars['$size-1'].value }}</code></p>
  39. </td>
  40. {% endcapture %}
  41. {% capture unchanged %}
  42. <td class="is-narrow">
  43. <p class="notification">unchanged</p>
  44. </td>
  45. {% endcapture %}
  46. {% capture left %}
  47. <td class="is-narrow">
  48. <p class="notification is-primary">left-aligned</p>
  49. </td>
  50. {% endcapture %}
  51. {% include elements/anchor.html name="Size" %}
  52. <div class="content">
  53. <p>
  54. There are <strong>{{ sizes | size }} sizes</strong> to choose from:
  55. </p>
  56. </div>
  57. <table class="table is-bordered">
  58. <thead>
  59. <tr>
  60. <th>
  61. Class
  62. </th>
  63. <th>
  64. Font-size
  65. </th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. {% for size in sizes %}
  70. <tr>
  71. {% assign key = '$size-' | append: forloop.index %}
  72. <td><code>is-size-{{ forloop.index }}</code></td>
  73. <td><code>{{ initial_vars[key].value }}</code></td>
  74. </tr>
  75. {% endfor %}
  76. </tbody>
  77. </table>
  78. {% include elements/anchor.html name="Responsive size" %}
  79. <div class="content">
  80. <p>
  81. You can choose a <strong>specific</strong> size for <em>each</em> viewport width. You simply need to append the <strong>viewport width</strong> to the size modifier.
  82. </p>
  83. <p>
  84. For example, here are the modifiers for <code>$size-1</code>:
  85. </p>
  86. </div>
  87. <div class="table-container">
  88. <table class="table is-bordered">
  89. {{ thead }}
  90. <tbody>
  91. <tr>
  92. <td><code>is-size-1-mobile</code></td>
  93. {{ size1 }}
  94. {{ unchanged }}
  95. {{ unchanged }}
  96. {{ unchanged }}
  97. {{ unchanged }}
  98. </tr>
  99. <tr>
  100. <td><code>is-size-1-tablet</code></td>
  101. {{ unchanged }}
  102. {{ size1 }}
  103. {{ unchanged }}
  104. {{ unchanged }}
  105. {{ unchanged }}
  106. </tr>
  107. <tr>
  108. <td><code>is-size-1-touch</code></td>
  109. {{ size1 }}
  110. {{ size1 }}
  111. {{ unchanged }}
  112. {{ unchanged }}
  113. {{ unchanged }}
  114. </tr>
  115. <tr>
  116. <td><code>is-size-1-desktop</code></td>
  117. {{ unchanged }}
  118. {{ unchanged }}
  119. {{ size1 }}
  120. {{ size1 }}
  121. {{ size1 }}
  122. </tr>
  123. <tr>
  124. <td><code>is-size-1-widescreen</code></td>
  125. {{ unchanged }}
  126. {{ unchanged }}
  127. {{ unchanged }}
  128. {{ size1 }}
  129. {{ size1 }}
  130. </tr>
  131. <tr>
  132. <td><code>is-size-1-fullhd</code></td>
  133. {{ unchanged }}
  134. {{ unchanged }}
  135. {{ unchanged }}
  136. {{ unchanged }}
  137. {{ size1 }}
  138. </tr>
  139. </tbody>
  140. </table>
  141. </div>
  142. <div class="content">
  143. <p>
  144. You can use the same logic for each of the <strong>7 sizes</strong>.
  145. </p>
  146. </div>
  147. {% include elements/anchor.html name="Colors" %}
  148. <div class="content">
  149. <p>
  150. You can set any element to one of the <strong>9 colors</strong> or <strong>9 shades of grey</strong>:
  151. </p>
  152. </div>
  153. <table class="table is-bordered">
  154. <thead>
  155. <tr>
  156. <th>
  157. Class
  158. </th>
  159. <th>
  160. Color
  161. </th>
  162. </tr>
  163. </thead>
  164. <tbody>
  165. <tr><td><code>has-text-white</code></td><td>{% include color/white.html %}</td></tr>
  166. <tr><td><code>has-text-black</code></td><td>{% include color/black.html %}</td></tr>
  167. <tr><td><code>has-text-light</code></td><td>{% include color/white-ter.html %}</td></tr>
  168. <tr><td><code>has-text-dark</code></td><td>{% include color/grey-darker.html %}</td></tr>
  169. <tr><td><code>has-text-primary</code></td><td>{% include color/turquoise.html %}</td></tr>
  170. <tr><td><code>has-text-info</code></td><td>{% include color/cyan.html %}</td></tr>
  171. <tr><td><code>has-text-link</code></td><td>{% include color/blue.html %}</td></tr>
  172. <tr><td><code>has-text-success</code></td><td>{% include color/green.html %}</td></tr>
  173. <tr><td><code>has-text-warning</code></td><td>{% include color/yellow.html %}</td></tr>
  174. <tr><td><code>has-text-danger</code></td><td>{% include color/red.html %}</td></tr>
  175. <tr><td><code>has-text-black-bis</code></td><td>{% include color/black-bis.html %}</td></tr>
  176. <tr><td><code>has-text-black-ter</code></td><td>{% include color/black-ter.html %}</td></tr>
  177. <tr><td><code>has-text-grey-darker</code></td><td>{% include color/grey-darker.html %}</td></tr>
  178. <tr><td><code>has-text-grey-dark</code></td><td>{% include color/grey-dark.html %}</td></tr>
  179. <tr><td><code>has-text-grey</code></td><td>{% include color/grey.html %}</td></tr>
  180. <tr><td><code>has-text-grey-light</code></td><td>{% include color/grey-light.html %}</td></tr>
  181. <tr><td><code>has-text-grey-lighter</code></td><td>{% include color/grey-lighter.html %}</td></tr>
  182. <tr><td><code>has-text-white-ter</code></td><td>{% include color/white-ter.html %}</td></tr>
  183. <tr><td><code>has-text-white-bis</code></td><td>{% include color/white-bis.html %}</td></tr>
  184. </tbody>
  185. </table>
  186. {% include elements/anchor.html name="Alignment" %}
  187. <div class="content">
  188. <p>
  189. You can align the text with the use of one of <strong>4 alignment helpers</strong>:
  190. </p>
  191. </div>
  192. <table class="table is-bordered">
  193. <thead>
  194. <tr>
  195. <th>
  196. Class
  197. </th>
  198. <th>
  199. Alignment
  200. </th>
  201. </tr>
  202. </thead>
  203. <tbody>
  204. <tr>
  205. <td><code>has-text-centered</code></td>
  206. <td>Makes the text <strong>centered</strong></td>
  207. </tr>
  208. <tr>
  209. <td><code>has-text-justified</code></td>
  210. <td>Makes the text <strong>justified</strong></td>
  211. </tr>
  212. <tr>
  213. <td><code>has-text-left</code></td>
  214. <td>Makes the text aligned to the <strong>left</strong></td>
  215. </tr>
  216. <tr>
  217. <td><code>has-text-right</code></td>
  218. <td>Makes the text aligned to the <strong>right</strong></td>
  219. </tr>
  220. </tbody>
  221. </table>
  222. {% include elements/anchor.html name="Responsive Alignment" %}
  223. <div class="content">
  224. <p>
  225. You can now <strong>align text</strong> for <em>each</em> viewport width. You simply need to append the <strong>viewport width</strong> to the alignment modifier.
  226. </p>
  227. <p>
  228. For example, here are the modifiers for <code>has-text-left</code>:
  229. </p>
  230. </div>
  231. <div class="table-container">
  232. <table class="table is-bordered">
  233. {{ thead }}
  234. <tbody>
  235. <tr>
  236. <td><code>has-text-left-mobile</code></td>
  237. {{ left }}
  238. {{ unchanged }}
  239. {{ unchanged }}
  240. {{ unchanged }}
  241. {{ unchanged }}
  242. </tr>
  243. <tr>
  244. <td><code>has-text-left-tablet</code></td>
  245. {{ unchanged }}
  246. {{ left }}
  247. {{ left }}
  248. {{ left }}
  249. {{ left }}
  250. </tr>
  251. <tr>
  252. <td><code>has-text-left-tablet-only</code></td>
  253. {{ unchanged }}
  254. {{ left }}
  255. {{ unchanged }}
  256. {{ unchanged }}
  257. {{ unchanged }}
  258. </tr>
  259. <tr>
  260. <td><code>has-text-left-touch</code></td>
  261. {{ left }}
  262. {{ left }}
  263. {{ unchanged }}
  264. {{ unchanged }}
  265. {{ unchanged }}
  266. </tr>
  267. <tr>
  268. <td><code>has-text-left-desktop</code></td>
  269. {{ unchanged }}
  270. {{ unchanged }}
  271. {{ left }}
  272. {{ left }}
  273. {{ left }}
  274. </tr>
  275. <tr>
  276. <td><code>has-text-left-desktop-only</code></td>
  277. {{ unchanged }}
  278. {{ unchanged }}
  279. {{ left }}
  280. {{ unchanged }}
  281. {{ unchanged }}
  282. </tr>
  283. <tr>
  284. <td><code>has-text-left-widescreen</code></td>
  285. {{ unchanged }}
  286. {{ unchanged }}
  287. {{ unchanged }}
  288. {{ left }}
  289. {{ left }}
  290. </tr>
  291. <tr>
  292. <td><code>has-text-left-widescreen-only</code></td>
  293. {{ unchanged }}
  294. {{ unchanged }}
  295. {{ unchanged }}
  296. {{ left }}
  297. {{ unchanged }}
  298. </tr>
  299. <tr>
  300. <td><code>has-text-left-fullhd</code></td>
  301. {{ unchanged }}
  302. {{ unchanged }}
  303. {{ unchanged }}
  304. {{ unchanged }}
  305. {{ left }}
  306. </tr>
  307. </tbody>
  308. </table>
  309. </div>
  310. {% include elements/anchor.html name="Text transformation" %}
  311. <div class="content">
  312. <p>
  313. You can transform the text with the use of one of <strong>4 text transformation helpers</strong>:
  314. </p>
  315. </div>
  316. <table class="table is-bordered">
  317. <thead>
  318. <tr>
  319. <th>
  320. Class
  321. </th>
  322. <th>
  323. Transformation
  324. </th>
  325. </tr>
  326. </thead>
  327. <tbody>
  328. <tr>
  329. <td><code>is-capitalized</code></td>
  330. <td>Transforms <strong>the first character</strong> of each word to <strong>uppercase</strong></td>
  331. </tr>
  332. <tr>
  333. <td><code>is-lowercase</code></td>
  334. <td>Transforms <strong>all characters</strong> to <strong>lowercase</strong></td>
  335. </tr>
  336. <tr>
  337. <td><code>is-uppercase</code></td>
  338. <td>Transforms <strong>all characters</strong> to <strong>uppercase</strong></td>
  339. </tr>
  340. <tr>
  341. <td><code>is-italic</code></td>
  342. <td>Transforms <strong>all characters</strong> to <strong>italic</strong></td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. {% include elements/anchor.html name="Text weight" %}
  347. <div class="content">
  348. <p>
  349. You can transform the text weight with the use of one of <strong>4 text weight helpers</strong>:
  350. </p>
  351. </div>
  352. <table class="table is-bordered">
  353. <thead>
  354. <tr>
  355. <th>
  356. Class
  357. </th>
  358. <th>
  359. Weight
  360. </th>
  361. </tr>
  362. </thead>
  363. <tbody>
  364. <tr>
  365. <td><code>has-text-weight-light</code></td>
  366. <td>Transforms text weight to <strong>light</strong></td>
  367. </tr>
  368. <tr>
  369. <td><code>has-text-weight-normal</code></td>
  370. <td>Transforms text weight to <strong>normal</strong></td>
  371. </tr>
  372. <tr>
  373. <td><code>has-text-weight-semibold</code></td>
  374. <td>Transforms text weight to <strong>semi-bold</strong></td>
  375. </tr>
  376. <tr>
  377. <td><code>has-text-weight-bold</code></td>
  378. <td>Transforms text weight to <strong>bold</strong></td>
  379. </tr>
  380. </tbody>
  381. </table>
  382. {% include elements/anchor.html name="Font family" %}
  383. {% include elements/new-tag.html version="0.7.4" %}
  384. <div class="content">
  385. <p>
  386. You can change the font family with the use of one of <strong>3 font family helpers</strong>:
  387. </p>
  388. </div>
  389. {% assign font_families = "sans-serif,monospace,primary,secondary,code" | split: ',' %}
  390. <table class="table is-bordered">
  391. <thead>
  392. <tr>
  393. <th>
  394. Class
  395. </th>
  396. <th>
  397. Family
  398. </th>
  399. </tr>
  400. </thead>
  401. <tbody>
  402. {% for family in font_families %}
  403. <tr>
  404. <td><code>is-family-{{ family }}</code></td>
  405. <td>Sets font family to <code>$family-{{ family }}</code></td>
  406. </tr>
  407. {% endfor %}
  408. </tbody>
  409. </table>