Welcome to mirror list, hosted at ThFree Co, Russian Federation.

typography-helpers.html « helpers « documentation « docs - github.com/jgthms/bulma.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 982892d865b6a6f324e4f0bfeec81186c383256b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
---
title: Typography helpers
layout: documentation
doc-tab: helpers
doc-subtab: helpers-typography
breadcrumb:
- home
- documentation
- helpers
- helpers-typography
---

{% assign initial_vars = site.data.variables.utilities.initial-variables.by_name %}
{% assign sizes        = site.data.variables.utilities.derived-variables.by_name['$sizes'].value | split: ' ' %}

{% capture thead %}
<thead>
  <tr>
    <th>
      Class
    </th>
    {% for breakpoint_hash in site.data.breakpoints %}
      {% assign breakpoint = breakpoint_hash[1] %}
      <th>
        {{ breakpoint.name }}<br>
        {% if breakpoint.id == 'mobile' %}
          Up to <code>{{ breakpoint.to }}px</code>
        {% elsif breakpoint.id == 'fullhd' %}
          <code>{{ breakpoint.from }}px</code> and above
        {% else %}
          Between <code>{{ breakpoint.from }}px</code> and <code>{{ breakpoint.to }}px</code>
        {% endif %}
      </th>
    {% endfor %}
  </tr>
</thead>
{% endcapture %}

{% capture size1 %}
<td class="is-narrow has-background-danger-light">
  <code class="has-background-danger-light">{{ initial_vars['$size-1'].value }}</code>
</td>
{% endcapture %}

{% capture unchanged %}
<td class="is-narrow has-text-grey-light">
  unchanged
</td>
{% endcapture %}

{% capture left %}
<td class="is-narrow has-background-primary-light has-text-primary">
  left-aligned
</td>
{% endcapture %}

{% include elements/anchor.html name="Size" %}

<div class="content">
  <p>
    There are <strong>{{ sizes | size }} sizes</strong> to choose from:
  </p>
</div>

<table class="table is-bordered">
  <thead>
    <tr>
      <th>
        Class
      </th>
      <th>
        Font-size
      </th>
      <th>
        Size
      </th>
    </tr>
  </thead>
  <tbody>
    {% for size in sizes %}
      <tr>
        {% assign key = '$size-' | append: forloop.index %}
        <td><code>is-size-{{ forloop.index }}</code></td>
        <td><code>{{ initial_vars[key].value }}</code></td>
        <td><span class="is-size-{{ forloop.index }}">Example</span></td>
      </tr>
    {% endfor %}
  </tbody>
</table>

{% include elements/anchor.html name="Responsive size" %}

<div class="content">
  <p>
    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.
  </p>
  <p>
    For example, here are the modifiers for <code>$size-1</code>:
  </p>
</div>

<div class="table-container">
  <table class="table is-bordered">
    {{ thead }}
    <tbody>
      <tr>
        <td class="is-narrow"><code>is-size-1-mobile</code></td>
        {{ size1 }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
      </tr>
      <tr>
        <td class="is-narrow"><code>is-size-1-touch</code></td>
        {{ size1 }}
        {{ size1 }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
      </tr>
      <tr>
        <td class="is-narrow"><code>is-size-1-tablet</code></td>
        {{ unchanged }}
        {{ size1 }}
        {{ size1 }}
        {{ size1 }}
        {{ size1 }}
      </tr>
      <tr>
        <td class="is-narrow"><code>is-size-1-desktop</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ size1 }}
        {{ size1 }}
        {{ size1 }}
      </tr>
      <tr>
        <td class="is-narrow"><code>is-size-1-widescreen</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ size1 }}
        {{ size1 }}
      </tr>
      <tr>
        <td class="is-narrow"><code>is-size-1-fullhd</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ size1 }}
      </tr>
    </tbody>
  </table>
</div>

<div class="content">
  <p>
    You can use the same logic for each of the <strong>7 sizes</strong>.
  </p>
</div>

{% include elements/anchor.html name="Alignment" %}

<div class="content">
  <p>
    You can align the text with the use of one of <strong>4 alignment helpers</strong>:
  </p>
</div>

<table class="table is-bordered">
  <thead>
    <tr>
      <th>
        Class
      </th>
      <th>
        Alignment
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
    <td><code>has-text-centered</code></td>
    <td>Makes the text <strong>centered</strong></td>
    </tr>
    <tr>
    <td><code>has-text-justified</code></td>
    <td>Makes the text <strong>justified</strong></td>
    </tr>
    <tr>
    <td><code>has-text-left</code></td>
    <td>Makes the text aligned to the <strong>left</strong></td>
    </tr>
    <tr>
    <td><code>has-text-right</code></td>
    <td>Makes the text aligned to the <strong>right</strong></td>
    </tr>
  </tbody>
</table>

{% include elements/anchor.html name="Responsive Alignment" %}

<div class="content">
  <p>
    You can <strong>align text</strong> differently for each <strong>viewport width</strong>. Simply append the <strong>viewport width</strong> to the alignment modifier.
  </p>

  <p>
    For example, here are the modifiers for <code>has-text-left</code>:
  </p>
</div>

<div class="table-container">
  <table class="table is-bordered">
    {{ thead }}
    <tbody>
      <tr>
        <td class="is-narrow"><code>has-text-left-mobile</code></td>
        {{ left }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-touch</code></td>
        {{ left }}
        {{ left }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-tablet-only</code></td>
        {{ unchanged }}
        {{ left }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-tablet</code></td>
        {{ unchanged }}
        {{ left }}
        {{ left }}
        {{ left }}
        {{ left }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-desktop-only</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ left }}
        {{ unchanged }}
        {{ unchanged }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-desktop</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ left }}
        {{ left }}
        {{ left }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-widescreen-only</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ left }}
        {{ unchanged }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-widescreen</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ left }}
        {{ left }}
      </tr>
      <tr>
        <td class="is-narrow"><code>has-text-left-fullhd</code></td>
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ unchanged }}
        {{ left }}
      </tr>
    </tbody>
  </table>
</div>

<div class="content">
  <p>
    You can use the same logic for each of the <strong>4 alignments</strong>.
  </p>
</div>

{% include elements/anchor.html name="Text transformation" %}

<div class="content">
  <p>
    You can transform the text with the use of one of <strong>4 text transformation helpers</strong>:
  </p>
</div>

<table class="table is-bordered">
  <thead>
  <tr>
    <th>
      Class
    </th>
    <th>
      Transformation
    </th>
  </tr>
  </thead>
  <tbody>
  <tr>
    <td><code>is-capitalized</code></td>
    <td>Transforms <strong>the first character</strong> of each word to <strong>uppercase</strong></td>
  </tr>
  <tr>
    <td><code>is-lowercase</code></td>
    <td>Transforms <strong>all characters</strong> to <strong>lowercase</strong></td>
  </tr>
  <tr>
    <td><code>is-uppercase</code></td>
    <td>Transforms <strong>all characters</strong> to <strong>uppercase</strong></td>
  </tr>
  <tr>
    <td><code>is-italic</code></td>
    <td>Transforms <strong>all characters</strong> to <strong>italic</strong></td>
  </tr>
  <tr>
    <td>{% include elements/new-tag.html version="0.9.3" %}<code>is-underlined</code></td>
    <td><strong>Underlines</strong> the text</td>
  </tr>
  </tbody>
</table>

{% include elements/anchor.html name="Text weight" %}

<div class="content">
  <p>
    You can transform the text weight with the use of one of <strong>5 text weight helpers</strong>:
  </p>
</div>

<table class="table is-bordered">
  <thead>
  <tr>
    <th>
      Class
    </th>
    <th>
      Weight
    </th>
  </tr>
  </thead>
  <tbody>
  <tr>
    <td><code>has-text-weight-light</code></td>
    <td>Transforms text weight to <strong>light</strong></td>
  </tr>
  <tr>
    <td><code>has-text-weight-normal</code></td>
    <td>Transforms text weight to <strong>normal</strong></td>
  </tr>
  <tr>
    <td><code>has-text-weight-medium</code></td>
    <td>Transforms text weight to <strong>medium</strong></td>
  </tr>
  <tr>
    <td><code>has-text-weight-semibold</code></td>
    <td>Transforms text weight to <strong>semi-bold</strong></td>
  </tr>
  <tr>
    <td><code>has-text-weight-bold</code></td>
    <td>Transforms text weight to <strong>bold</strong></td>
  </tr>
  </tbody>
</table>

{% include elements/anchor.html name="Font family" %}

<div class="content">
  <p>
    You can change the font family with the use of one of <strong>5 font family helpers</strong>:
  </p>
</div>

{% assign font_families = "sans-serif,monospace,primary,secondary,code" | split: ',' %}

<table class="table is-bordered">
  <thead>
    <tr>
      <th>
        Class
      </th>
      <th>
        Family
      </th>
    </tr>
  </thead>
  <tbody>
    {% for family in font_families %}
      <tr>
        <td><code>is-family-{{ family }}</code></td>
        <td>Sets font family to <code>$family-{{ family }}</code></td>
      </tr>
    {% endfor %}
  </tbody>
</table>