typography-helpers.html 11 KB

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