bulma/docs/documentation/helpers/typography-helpers.html

366 lines
9.6 KiB
HTML
Raw Normal View History

2020-05-10 21:10:51 +00:00
---
title: Typography helpers
2024-03-21 16:11:54 +00:00
layout: docs
theme: helpers
2020-05-10 21:10:51 +00:00
doc-tab: helpers
doc-subtab: helpers-typography
breadcrumb:
2024-03-21 16:11:54 +00:00
- home
- documentation
- helpers
- helpers-typography
2020-05-10 21:10:51 +00:00
---
2024-03-21 16:11:54 +00:00
{% 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 %}
2020-05-10 21:10:51 +00:00
<thead>
<tr>
2024-03-21 16:11:54 +00:00
<th>Class</th>
{% for breakpoint_hash in site.data.breakpoints %} {% assign breakpoint =
breakpoint_hash[1] %}
2020-05-10 21:10:51 +00:00
<th>
2024-03-21 16:11:54 +00:00
{{ 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 %}
2020-05-10 21:10:51 +00:00
</th>
{% endfor %}
</tr>
</thead>
2024-03-21 16:11:54 +00:00
{% endcapture %} {% capture size1 %}
2020-05-10 23:25:29 +00:00
<td class="is-narrow has-background-danger-light">
2024-03-21 16:11:54 +00:00
<code class="has-background-danger-light"
>{{ initial_vars['$size-1'].value }}</code
>
2020-05-10 21:10:51 +00:00
</td>
2024-03-21 16:11:54 +00:00
{% endcapture %} {% capture unchanged %}
<td class="is-narrow has-text-grey-light">unchanged</td>
{% endcapture %} {% capture left %}
2020-05-10 23:25:29 +00:00
<td class="is-narrow has-background-primary-light has-text-primary">
left-aligned
2020-05-10 21:10:51 +00:00
</td>
2024-03-21 16:11:54 +00:00
{% endcapture %} {% include docs/elements/anchor.html name="Size" %}
2020-05-10 21:10:51 +00:00
<div class="content">
2024-03-21 16:11:54 +00:00
<p>There are <strong>{{ sizes | size }} sizes</strong> to choose from:</p>
2020-05-10 21:10:51 +00:00
</div>
<table class="table is-bordered">
<thead>
<tr>
2024-03-21 16:11:54 +00:00
<th>Class</th>
<th>Font-size</th>
<th>Size</th>
2020-05-10 21:10:51 +00:00
</tr>
</thead>
<tbody>
{% for size in sizes %}
2024-03-21 16:11:54 +00:00
<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>
2020-05-10 21:10:51 +00:00
{% endfor %}
</tbody>
</table>
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Responsive size" %}
2020-05-10 21:10:51 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
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.
2020-05-10 21:10:51 +00:00
</p>
2024-03-21 16:11:54 +00:00
<p>For example, here are the modifiers for <code>$size-1</code>:</p>
2020-05-10 21:10:51 +00:00
</div>
2020-05-10 23:25:29 +00:00
<div class="table-container">
<table class="table is-bordered">
{{ thead }}
<tbody>
<tr>
<td class="is-narrow"><code>is-size-1-mobile</code></td>
2024-03-21 16:11:54 +00:00
{{ size1 }} {{ unchanged }} {{ unchanged }} {{ unchanged }} {{ unchanged
}}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>is-size-1-touch</code></td>
2024-03-21 16:11:54 +00:00
{{ size1 }} {{ size1 }} {{ unchanged }} {{ unchanged }} {{ unchanged }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>is-size-1-tablet</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ size1 }} {{ size1 }} {{ size1 }} {{ size1 }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>is-size-1-desktop</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ size1 }} {{ size1 }} {{ size1 }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>is-size-1-widescreen</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ unchanged }} {{ size1 }} {{ size1 }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>is-size-1-fullhd</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ unchanged }} {{ unchanged }} {{ size1
}}
2020-05-10 23:25:29 +00:00
</tr>
</tbody>
</table>
</div>
2020-05-10 21:10:51 +00:00
<div class="content">
2024-03-21 16:11:54 +00:00
<p>You can use the same logic for each of the <strong>7 sizes</strong>.</p>
2020-05-10 21:10:51 +00:00
</div>
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Alignment" %}
2020-05-10 21:10:51 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
You can align the text with the use of one of
<strong>4 alignment helpers</strong>:
2020-05-10 21:10:51 +00:00
</p>
</div>
<table class="table is-bordered">
<thead>
<tr>
2024-03-21 16:11:54 +00:00
<th>Class</th>
<th>Alignment</th>
2020-05-10 21:10:51 +00:00
</tr>
</thead>
<tbody>
<tr>
2024-03-21 16:11:54 +00:00
<td><code>has-text-centered</code></td>
<td>Makes the text <strong>centered</strong></td>
2020-05-10 21:10:51 +00:00
</tr>
<tr>
2024-03-21 16:11:54 +00:00
<td><code>has-text-justified</code></td>
<td>Makes the text <strong>justified</strong></td>
2020-05-10 21:10:51 +00:00
</tr>
<tr>
2024-03-21 16:11:54 +00:00
<td><code>has-text-left</code></td>
<td>Makes the text aligned to the <strong>left</strong></td>
2020-05-10 21:10:51 +00:00
</tr>
<tr>
2024-03-21 16:11:54 +00:00
<td><code>has-text-right</code></td>
<td>Makes the text aligned to the <strong>right</strong></td>
2020-05-10 21:10:51 +00:00
</tr>
</tbody>
</table>
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Responsive Alignment" %}
2020-05-10 21:10:51 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
You can <strong>align text</strong> differently for each
<strong>viewport width</strong>. Simply append the
<strong>viewport width</strong> to the alignment modifier.
2020-05-10 21:10:51 +00:00
</p>
2024-03-21 16:11:54 +00:00
<p>For example, here are the modifiers for <code>has-text-left</code>:</p>
2020-05-10 21:10:51 +00:00
</div>
2020-05-10 23:25:29 +00:00
<div class="table-container">
<table class="table is-bordered">
{{ thead }}
<tbody>
<tr>
<td class="is-narrow"><code>has-text-left-mobile</code></td>
2024-03-21 16:11:54 +00:00
{{ left }} {{ unchanged }} {{ unchanged }} {{ unchanged }} {{ unchanged
}}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-touch</code></td>
2024-03-21 16:11:54 +00:00
{{ left }} {{ left }} {{ unchanged }} {{ unchanged }} {{ unchanged }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-tablet-only</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ left }} {{ unchanged }} {{ unchanged }} {{ unchanged
}}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-tablet</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ left }} {{ left }} {{ left }} {{ left }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-desktop-only</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ left }} {{ unchanged }} {{ unchanged
}}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-desktop</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ left }} {{ left }} {{ left }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-widescreen-only</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ unchanged }} {{ left }} {{ unchanged
}}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-widescreen</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ unchanged }} {{ left }} {{ left }}
2020-05-10 23:25:29 +00:00
</tr>
<tr>
<td class="is-narrow"><code>has-text-left-fullhd</code></td>
2024-03-21 16:11:54 +00:00
{{ unchanged }} {{ unchanged }} {{ unchanged }} {{ unchanged }} {{ left
}}
2020-05-10 23:25:29 +00:00
</tr>
</tbody>
</table>
</div>
2020-05-10 21:10:51 +00:00
2020-05-10 23:25:29 +00:00
<div class="content">
<p>
You can use the same logic for each of the <strong>4 alignments</strong>.
</p>
</div>
2020-05-10 21:10:51 +00:00
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Text transformation" %}
2020-05-10 21:10:51 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
You can transform the text with the use of one of
<strong>4 text transformation helpers</strong>:
2020-05-10 21:10:51 +00:00
</p>
</div>
<table class="table is-bordered">
<thead>
2024-03-21 16:11:54 +00:00
<tr>
<th>Class</th>
<th>Transformation</th>
</tr>
2020-05-10 21:10:51 +00:00
</thead>
<tbody>
2024-03-21 16:11:54 +00:00
<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 class="is-italic">italic</strong>
</td>
</tr>
<tr>
<td>
<code>is-underlined</code>
</td>
<td><strong class="is-underlined">Underlines</strong> the text</td>
</tr>
2020-05-10 21:10:51 +00:00
</tbody>
</table>
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Text weight" %}
2020-05-10 21:10:51 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
You can transform the text weight with the use of one of
<strong>5 text weight helpers</strong>:
2020-05-10 21:10:51 +00:00
</p>
</div>
<table class="table is-bordered">
<thead>
2024-03-21 16:11:54 +00:00
<tr>
<th>Class</th>
<th>Weight</th>
</tr>
2020-05-10 21:10:51 +00:00
</thead>
<tbody>
<tr>
<td><code>has-text-weight-light</code></td>
2024-03-21 16:11:54 +00:00
<td>
Transforms text weight to
<span class="has-text-weight-light">light</span>
</td>
</tr>
<tr>
<td><code>has-text-weight-normal</code></td>
2024-03-21 16:11:54 +00:00
<td>
Transforms text weight to
<span class="has-text-weight-normal">normal</span>
</td>
</tr>
<tr>
<td><code>has-text-weight-medium</code></td>
2024-03-21 16:11:54 +00:00
<td>
Transforms text weight to
<span class="has-text-weight-medium">medium</span>
</td>
</tr>
<tr>
<td><code>has-text-weight-semibold</code></td>
2024-03-21 16:11:54 +00:00
<td>
Transforms text weight to
<span class="has-text-weight-semibold">semi-bold</span>
</td>
</tr>
<tr>
<td><code>has-text-weight-bold</code></td>
2024-03-21 16:11:54 +00:00
<td>
Transforms text weight to <span class="has-text-weight-bold">bold</span>
</td>
</tr>
2020-05-10 21:10:51 +00:00
</tbody>
</table>
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Font family" %}
2020-05-10 21:10:51 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
You can change the font family with the use of one of
<strong>5 font family helpers</strong>:
2020-05-10 21:10:51 +00:00
</p>
</div>
2024-03-21 16:11:54 +00:00
{% assign font_families = 'sans-serif,monospace,primary,secondary,code' | split:
',' %}
2020-05-10 21:10:51 +00:00
<table class="table is-bordered">
<thead>
<tr>
2024-03-21 16:11:54 +00:00
<th>Class</th>
<th>Family</th>
2020-05-10 21:10:51 +00:00
</tr>
</thead>
<tbody>
{% for family in font_families %}
2024-03-21 16:11:54 +00:00
<tr>
<td>
<code>is-family-{{ family }}</code>
</td>
<td>Sets font family to <code>$family-{{ family }}</code></td>
</tr>
2020-05-10 21:10:51 +00:00
{% endfor %}
</tbody>
</table>