typography-helpers.html 11 KB

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