sass/utilities/mixins.scss.
Responsive Mixins
Bulma’s responsive mixins make it easy to apply styles at specific breakpoints.Basic Breakpoint Mixins
@mixin mobile
Applies styles for mobile devices only (up to 768px).
@mixin tablet
Applies styles for tablet and larger screens (from 769px).
@mixin tablet-only
Applies styles for tablet devices only (769px to 1023px).
@mixin touch
Applies styles for touch devices (up to 1023px).
@mixin desktop
Applies styles for desktop and larger screens (from 1024px).
@mixin desktop-only
Applies styles for desktop only (1024px to 1215px).
@mixin widescreen
Applies styles for widescreen and larger (from 1216px).
@mixin widescreen-only
Applies styles for widescreen only (1216px to 1407px).
@mixin fullhd
Applies styles for full HD screens (from 1408px).
Advanced Responsive Mixins
@mixin from($device)
Applies styles from a specific breakpoint and up.
Parameters:
$device- Minimum width value
@mixin until($device)
Applies styles up to a specific breakpoint.
Parameters:
$device- Maximum width value (exclusive)
@mixin between($from, $until)
Applies styles between two breakpoints.
Parameters:
$from- Minimum width value$until- Maximum width value (exclusive)
@mixin breakpoint($name)
Applies styles using a named breakpoint from the $breakpoints map.
Parameters:
$name- Breakpoint name (e.g., “mobile”, “tablet”, “desktop”)
Container Query Mixins
@mixin container-from($name, $width)
Applies styles based on container width (minimum).
Parameters:
$name- Container name$width- Minimum width value
@mixin container-until($name, $width)
Applies styles based on container width (maximum).
Parameters:
$name- Container name$width- Maximum width value
Layout Mixins
@mixin clearfix
Clears floats using the clearfix technique.
@mixin center($width, $height: 0)
Centers an absolutely positioned element.
Parameters:
$width- Element width$height- Element height (optional, defaults to$width)
@mixin overlay($offset: 0)
Positions an element to cover its parent.
Parameters:
$offset- Offset from edges (default: 0)
@mixin block($spacing)
Adds bottom margin to all elements except the last.
Parameters:
$spacing- Bottom margin value (default: CSS variable)
Component Mixins
@mixin arrow($color)
Creates a CSS arrow (chevron).
Parameters:
$color- Arrow color (default: CSS variable)
@mixin delete
Creates a delete button with an X icon.
@mixin loader
Creates a loading spinner.
@mixin burger($dimensions)
Creates a hamburger menu icon.
Parameters:
$dimensions- Icon size
@mixin fa($size, $dimensions)
Styles for Font Awesome icons.
Parameters:
$size- Font size$dimensions- Icon container dimensions
Utility Mixins
@mixin reset
Resets default element styles.
@mixin unselectable
Makes element text unselectable.
@mixin overflow-touch
Enables momentum scrolling on touch devices.
@mixin placeholder
Styles for input placeholder text.
@mixin selection($current-selector: false)
Styles for selected text.
Parameters:
$current-selector- Apply to current selector (default: false)
RTL (Right-to-Left) Mixins
@mixin ltr
Applies styles only in LTR mode.
@mixin rtl
Applies styles only in RTL mode.
@mixin ltr-property($property, $spacing, $right: true)
Applies directional properties that respect RTL.
Parameters:
$property- CSS property (e.g., “margin”, “padding”)$spacing- Value$right- Apply to right side (default: true)
@mixin ltr-position($spacing, $right: true)
Applies directional positioning that respects RTL.
Parameters:
$spacing- Position value$right- Apply to right side (default: true)
Complete Example
Here’s a complete example combining multiple mixins:All responsive mixins can be combined and nested to create complex responsive layouts. The mixins are mobile-first by default.
