bulma/docs/documentation/columns/gap.html

282 lines
7.2 KiB
HTML
Raw Normal View History

2017-08-14 18:12:07 +00:00
---
title: Columns gap
layout: documentation
doc-tab: columns
doc-subtab: gap
2018-04-09 11:45:52 +00:00
breadcrumb:
- 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">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">
2017-08-14 22:52:28 +00:00
Default gap
</p>
2017-08-14 18:12:07 +00:00
</div>
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">
2017-08-14 22:52:28 +00:00
Default gap
</p>
2017-08-14 18:12:07 +00:00
</div>
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">
2017-08-14 22:52:28 +00:00
Default gap
</p>
2017-08-14 18:12:07 +00:00
</div>
<div class="column">
2018-04-10 10:45:48 +00:00
<p class="bd-notification is-primary">
2017-08-14 22:52:28 +00:00
Default gap
</p>
</div>
</div>
{% endcapture %}
{% capture columns_gapless %}
<div class="columns is-gapless">
<div class="column">
No gap
</div>
<div class="column">
No gap
</div>
<div class="column">
No gap
</div>
<div class="column">
No gap
</div>
</div>
{% endcapture %}
{% capture columns_gapless_multiline %}
<div class="columns is-gapless is-multiline is-mobile">
<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>
2017-12-20 17:13:54 +00:00
<div class="column is-one-quarter">
is-one-quarter
</div>
2017-08-14 22:52:28 +00:00
<div class="column">
Auto
2017-08-14 18:12:07 +00:00
</div>
</div>
{% endcapture %}
{% capture columns_variable_responsive_gaps %}
<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 %}
2018-04-09 21:25:26 +00:00
{% include 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>
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>.
<br>
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.
</p>
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
{{ columns_default_gap }}
2017-08-14 22:52:28 +00:00
2018-04-09 21:25:26 +00:00
{% include 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>
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:
</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">
2018-04-09 11:45:52 +00:00
{% highlight html %}{{ columns_gapless }}{% endhighlight %}
</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">
2018-04-09 11:45:52 +00:00
{% highlight html %}{{ columns_gapless_multiline }}{% endhighlight %}
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 21:25:26 +00:00
{% include elements/anchor.html name="Variable gap" %}
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
<div class="field is-grouped is-grouped-multiline">
<div class="control">
<div class="tags">
<span class="tag is-warning">Experimental</span>
2017-08-14 22:52:28 +00:00
</div>
2018-04-09 11:45:52 +00:00
</div>
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 11:45:52 +00:00
<div class="content">
<p>
You can specify a <strong>custom column gap</strong> by appending one of <strong>9 modifiers</strong> on the <code>.columns</code> container.
</p>
<ul>
<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>
</ul>
<p>
Additionally, <code>.is-variable</code> should be added on the <code>.columns</code> container.
</p>
</div>
2017-08-14 22:52:28 +00:00
2018-04-09 21:25:26 +00:00
{% include 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>
2020-05-13 17:37:37 +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>
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>.
</p>
2017-08-14 18:12:07 +00:00
</div>
2018-04-09 11:45:52 +00:00
</div>
{% assign vernum = site.data.meta.version | downcase | remove: "." | plus: 0 %}
{% if vernum >= 72 %}
{% include elements/anchor.html name="Breakpoint based column gaps" %}
<div class="content">
<p>
You can define a column gap for each viewport size:
</p>
<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>
<div class="bd-highlight-full">
{% highlight html %}{{ columns_variable_responsive_gaps }}{% endhighlight %}
</div>
<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>
<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 %}