@@ -38,7 +42,7 @@ breadcrumb: -
Hamburger
+{% include elements/anchor-bis.html name="Hamburger" %}@@ -62,7 +66,7 @@ breadcrumb: -
Delete
+{% include elements/anchor-bis.html name="Delete" %}@@ -85,7 +89,7 @@ breadcrumb: -
Loader
+{% include elements/anchor-bis.html name="Loader" %}@@ -105,31 +109,7 @@ breadcrumb: -
Block
- -
- The block()
mixin adds spacing below an element, but only if it's not the last child.
-
- The $spacing
parameter defines the value of the margin-bottom
.
-
This element has a margin-bottom.
-This element too.
-Not this one because it's the last child.
-{% endcapture %} - -{% include elements/snippet.html content=block %} - - - -Font Awesome container
+{% include elements/anchor-bis.html name="Font Awesome container" %}@@ -156,29 +136,393 @@ breadcrumb: -@include overlay($offset: 0) +{% include elements/anchor.html name="CSS Mixins" %} -@include placeholder +
+ These mixins add CSS rules to the element. +
-// Tools + -@include clearfix +{% include elements/anchor-bis.html name="Block" %} -@include center($width, $height: 0) +
+ The block()
mixin adds spacing below an element, but only if it's not the last child.
+
+ The $spacing
parameter defines the value of the margin-bottom
.
+
This element has a margin-bottom.
+This element too.
+Not this one because it's the last child.
+{% endcapture %} -@include unselectable +{% include elements/snippet.html content=block %} -// RTL + -@include ltr +{% include elements/anchor-bis.html name="Overlay" %} -@include rtl +
+ The overlay()
mixin makes the element cover its closest positioned ancestor.
+
+ The $offset
parameter defines how far inside the element is positioned from each edge (top, bottom, left and right).
+
+ The center()
mixin allows you to absolutely position an element with fixed dimensions at the center of its closest positioned ancestor.
+
+ The value of the $width
parameter should be the width of the element the mixin is applied on.
+
+ Unless the element has square dimensions, the second parameter $height
is required and its value should be the height of the element the mixin is applied on.
+
+ The placeholder()
mixin allows you to change the style of an input's placeholder.
+
+ The $offset
parameter defines how far inside the element is positioned from each edge (top, bottom, left and right).
+
+ The clearfix()
mixin adds a ::after
pseudo-element with a clear: both
rule.
+
This is a short image description.
+This text is following the clearfix element and is correctly placed after.
+{% endcapture %} + +{% include elements/snippet.html content=clearfix %} + + + +{% include elements/anchor-bis.html name="Reset" %} + +
+ The reset()
mixin applies a soft style reset. This is especially useful for <button>
elements.
+
+ The unselectable()
mixin makes an element not selectable. This is to prevent the text to be selected when double-clicked.
+
This text is selectable.
+This text is not selectable.
+{% endcapture %} + +{% include elements/snippet.html content=unselectable %} + + + +{% include elements/anchor-bis.html name="Overflow Touch" %} + +
+ The overflow-touch()
mixin add the -webkit-overflow-scrolling: touch;
rule to the element.
+
+ Bulma has a global $rtl
flag, which allows the framework to output a Right-to-left version of the CSS. By default, this flag's value is set to false
. This means the framework output a Left-to-right version.
+
+ The mixins @mixin ltr
and @mixin rtl
are here to output CSS rules based on the value of $rtl
:
+
-
+
-
+ if
$rtl: true
,@include ltr
outputs nothing +
+ -
+ if
$rtl: false
,@include rtl
outputs nothing +
+
+ This is useful for properties that are specific to the side of an element. +
+
+ The ltr-position()
mixin is a quick way to switch between left
and right
CSS properties when dealing with positioned elements.
+
+ The first $spacing
parameter defines the value of the offset, whether it's right or left.
+
+ The second $right
parameter defines if the property outputs right
(default) or left
.
+
+ Here is what the output looks like with a $spacing
parameter set to 1rem
:
+
Flag → | +$rtl: false; |
+ $rtl: true; |
+
---|---|---|
@include ltr-position(1rem, true) |
+ right: 1rem |
+ left: 1rem |
+
@include ltr-position(1rem, false) |
+ left: 1rem |
+ right: 1rem |
+
Sass source
+ +{% highlight sass %}.bulma-ltr-position-mixin { + @include ltr-position(1rem, false); + border-radius: 0.25em; + position: absolute; + top: 1rem; +}{% endhighlight %} + +CSS output
+ +{% highlight css %}.bulma-ltr-position-mixin { + left: 1rem; + border-radius: 0.25em; + position: absolute; + top: 1rem; +}{% endhighlight %} + +{% capture ltr-position %} +Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Curabitur blandit tempus porttitor. Maecenas faucibus mollis interdum.
+
+ The ltr-property()
mixin works like the ltr-position()
mixin but allows you to choose which CSS property to set. The mixin will append -right
or -left
to that property. This is especially useful for margin
and padding
.
+
+ The first $property
parameter which property you want to "flip" left and right.
+
+ The second $spacing
parameter defines the value of the offset, whether it's right or left.
+
+ The third $right
parameter defines if the property outputs right
(default) or left
.
+
+ Here is what the output looks like with a $spacing
parameter set to 1rem
:
+
Flag → | +$rtl: false; |
+ $rtl: true; |
+
---|---|---|
@include ltr-property("margin", 1rem, true) |
+ margin-right: 1rem |
+ margin-left: 1rem |
+
@include ltr-property("margin", 1rem, false) |
+ margin-left: 1rem |
+ margin-right: 1rem |
+
Sass source
+ +{% highlight sass %}.bulma-ltr-property-mixin { + @include ltr-property("margin", 1rem, false); + border-radius: 0.25em; +}{% endhighlight %} + +CSS output
+ +{% highlight css %}.bulma-ltr-property-mixin { + margin-left: 1rem; + border-radius: 0.25em; +}{% endhighlight %} + +{% capture ltr-property %} +Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Curabitur blandit tempus porttitor. Maecenas faucibus mollis interdum.
+ +=arrow($color) |
- Creates a CSS-only down arrow. Used for the dropdown select. | -
=block |
- Defines a margin-bottom of 1.5rem, except when the element is the last child. Used for almost all block elements. | -
=clearfix |
- Adds a clearfix at the end of the element. Used for the "is-clearfix" helper. | -
=center($size) |
- Positions an element in the exact center of its parent. Used for the spinner in a loading button. | -
=delete |
- Creates a CSS-only cross. Used for the delete element in modals, messages, tags... | -
=fa($size, $dimensions) |
- Sets the style of a Font Awesome icon container. | -
=hamburger($dimensions) |
- Creates a CSS-only hamburger menu with 3 bars. Used for the "nav-toggle". | -
=loader |
- Creates a CSS-only loading spinner. Used for the ".loader" element, and for input and button spinners. | -
=overflow-touch |
- Sets the style of a container so that it keeps momentum when scrolling on iOS devices. | -
=overlay($offset: 0) |
- Makes the element overlay its parent container, like the transparent modal background. | -
=placeholder |
- Sets the styles of an input placeholder. | -
=unselectable |
- Turns the element unselectable. Used for buttons to prevent selection when clicking. | -
These mixins are already used throughout Bulma, but you can use them as well to extend your own styles.
-