bulma/docs/documentation/columns/gap.html

236 lines
7.0 KiB
HTML
Raw Normal View History

2017-08-14 18:12:07 +00:00
---
title: Columns gap
2024-03-21 16:11:54 +00:00
layout: docs
theme: library
doc-library: true
2017-08-14 18:12:07 +00:00
doc-tab: columns
doc-subtab: gap
2018-04-09 11:45:52 +00:00
breadcrumb:
2024-03-21 16:11:54 +00:00
- home
- documentation
- columns
- columns-gap
2017-08-14 18:12:07 +00:00
---
2017-08-14 22:52:28 +00:00
{% capture columns_default_gap %}
2017-08-14 18:12:07 +00:00
<div class="columns">
<div class="column">
2024-03-21 16:11:54 +00:00
<p class="bd-notification is-primary">Default gap</p>
2017-08-14 18:12:07 +00:00
</div>
<div class="column">
2024-03-21 16:11:54 +00:00
<p class="bd-notification is-primary">Default gap</p>
2017-08-14 18:12:07 +00:00
</div>
<div class="column">
2024-03-21 16:11:54 +00:00
<p class="bd-notification is-primary">Default gap</p>
2017-08-14 18:12:07 +00:00
</div>
<div class="column">
2024-03-21 16:11:54 +00:00
<p class="bd-notification is-primary">Default gap</p>
2017-08-14 22:52:28 +00:00
</div>
</div>
{% endcapture %}
{% capture columns_gapless %}
<div class="columns is-gapless">
2024-03-21 16:11:54 +00:00
<div class="column">No gap</div>
<div class="column">No gap</div>
<div class="column">No gap</div>
<div class="column">No gap</div>
2017-08-14 22:52:28 +00:00
</div>
{% endcapture %}
{% capture columns_gapless_multiline %}
<div class="columns is-gapless is-multiline is-mobile">
2024-03-21 16:11:54 +00:00
<div class="column is-one-quarter">is-one-quarter</div>
<div class="column is-one-quarter">is-one-quarter</div>
<div class="column is-one-quarter">is-one-quarter</div>
<div class="column is-one-quarter">is-one-quarter</div>
<div class="column is-half">is-half</div>
<div class="column is-one-quarter">is-one-quarter</div>
<div class="column is-one-quarter">is-one-quarter</div>
<div class="column is-one-quarter">is-one-quarter</div>
<div class="column">Auto</div>
2017-08-14 18:12:07 +00:00
</div>
{% endcapture %}
{% capture columns_variable_responsive_gaps %}
2024-03-21 16:11:54 +00:00
<div
class="columns is-variable is-1-mobile is-0-tablet is-3-desktop is-8-widescreen is-2-fullhd"
>
<div class="column">Column</div>
<div class="column">Column</div>
<div class="column">Column</div>
<div class="column">Column</div>
<div class="column">Column</div>
<div class="column">Column</div>
</div>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Default gap" %}
2017-08-14 18:12:07 +00:00
2018-04-09 11:45:52 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
Each column has a <strong>gap</strong> equal to the <strong>variable</strong> <code>$column-gap</code>, which has a
default value of <code>0.75rem</code>.
2018-04-09 11:45:52 +00:00
<br>
2024-03-21 16:11:54 +00:00
Since the gap is on <em>each side</em> of a column, the gap between two adjacent columns will be twice the value of
<code>$column-gap</code>, or <code>1.5rem</code> by default.
2018-04-09 11:45:52 +00:00
</p>
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
{{ columns_default_gap }}
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Gapless" %}
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
If you want to remove the <strong>space</strong> between the columns, add the <code>is-gapless</code> modifier on
the <code>columns</code> container:
2018-04-09 11:45:52 +00:00
</p>
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
<div class="columns is-gapless">
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">First column</p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">Second column</p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">Third column</p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">Fourth column</p>
2018-04-09 11:45:52 +00:00
</div>
</div>
2017-08-14 22:52:28 +00:00
<div class="bd-highlight-full">
2024-03-21 16:11:54 +00:00
{% highlight html -%}
{{- columns_gapless -}}
{%- endhighlight %}
2018-04-09 11:45:52 +00:00
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
<div class="content">
<p>You can combine it with the <code>is-multiline</code> modifier:</p>
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
<div class="columns is-multiline is-mobile is-gapless">
<div class="column is-one-quarter">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-one-quarter</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column is-one-quarter">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-one-quarter</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column is-one-quarter">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-one-quarter</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column is-one-quarter">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-one-quarter</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column is-half">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-half</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column is-one-quarter">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-one-quarter</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column is-one-quarter">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-one-quarter</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column is-one-quarter">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary"><code>is-one-quarter</code></p>
2018-04-09 11:45:52 +00:00
</div>
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">Auto</p>
2018-04-09 11:45:52 +00:00
</div>
</div>
2017-08-14 22:52:28 +00:00
<div class="bd-highlight-full">
2024-03-21 16:11:54 +00:00
{% highlight html -%}
{{- columns_gapless_multiline -}}
{%- endhighlight %}
2018-04-09 11:45:52 +00:00
</div>
2017-08-14 22:52:28 +00:00
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Variable gap" %}
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
You can specify a <strong>custom column gap</strong> by appending one of <strong>9 modifiers</strong> on the
<code>.columns</code> container.
2018-04-09 11:45:52 +00:00
</p>
<ul>
2024-03-21 16:11:54 +00:00
<li><code>is-0</code> will remove any gap (similar to <code>is-gapless</code>)</li>
<li><code>is-3</code> is the <strong>default value</strong>, equivalent to the <code>0.75rem</code> value</li>
<li><code>is-8</code> is the maximum gap of <code>2rem</code></li>
2018-04-09 11:45:52 +00:00
</ul>
2024-03-21 16:11:54 +00:00
<p>Additionally, <code>.is-variable</code> should be added on the <code>.columns</code> container.</p>
2018-04-09 11:45:52 +00:00
</div>
2017-08-14 22:52:28 +00:00
2024-03-21 16:11:54 +00:00
{% include docs/content/klmn.html %}
2017-08-14 18:12:07 +00:00
2018-04-09 11:45:52 +00:00
<div class="message is-warning">
<div class="message-body">
<p>
2024-03-21 16:11:54 +00:00
This feature is only available in browsers that support
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables"
>CSS Variables</a
>.
2018-04-09 11:45:52 +00:00
</p>
</div>
</div>
2017-12-04 21:03:01 +00:00
2018-04-09 11:45:52 +00:00
<div class="message is-info">
<div class="message-body">
<p>
2024-03-21 16:11:54 +00:00
If your Sass setup doesn't support CSS Variables, you can
<strong>disable this feature</strong> by setting <code>$variable-columns</code> to <code>false</code>.
2018-04-09 11:45:52 +00:00
</p>
2017-08-14 18:12:07 +00:00
</div>
2018-04-09 11:45:52 +00:00
</div>
2024-03-21 16:11:54 +00:00
{% assign vernum = site.data.meta.version | downcase | remove: '.' | plus: 0 %}
{% if vernum >= 72 %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/anchor.html name="Breakpoint
based column gaps"
%}
2024-03-21 16:11:54 +00:00
<div class="content">
<p>You can define a column gap for each viewport size:</p>
2024-03-21 16:11:54 +00:00
<p>
For example, here's how it looks with the following modifiers:
<code>is-variable is-2-mobile is-0-tablet is-3-desktop is-8-widescreen is-1-fullhd</code>
</p>
</div>
2024-03-21 16:11:54 +00:00
<div class="bd-highlight-full">
{% highlight html -%}
{{- columns_variable_responsive_gaps -}}
{%- endhighlight %}
</div>
2024-03-21 16:11:54 +00:00
<div
class="columns is-variable is-1-mobile is-0-tablet is-3-desktop is-8-widescreen is-2-fullhd"
>
<div class="column">
<p class="bd-notification is-primary">Column</p>
</div>
<div class="column">
<p class="bd-notification is-primary">Column</p>
</div>
<div class="column">
<p class="bd-notification is-primary">Column</p>
</div>
<div class="column">
<p class="bd-notification is-primary">Column</p>
</div>
<div class="column">
<p class="bd-notification is-primary">Column</p>
</div>
<div class="column">
<p class="bd-notification is-primary">Column</p>
</div>
</div>
2024-03-21 16:11:54 +00:00
<div class="message is-info">
<p class="message-body">
If you want to see the difference, resize your browser and see how the
<strong>columns gap</strong> varies.
</p>
</div>
{% endif %}