LEARNING OBJECTIVES ⌵
- Understand Bulma’s zero-JavaScript architectural philosophy and how pure CSS frameworks differ from bundled JS widget libraries.
- Master the
.columnsand.columnflexbox layout engine using both fractional syntax (is-half,is-one-third) and 12-column integer scales (is-6,is-4). - Implement core Bulma layout primitives:
.hero,.level(flexbox toolbar),.media(media object), and.card. - Differentiate between state/color modifiers (
.is-*) and property/alignment helpers (.has-*).
📖 The Mental Model & Story (Intuitive Foundation)
Imagine purchasing a precision Swiss wristwatch. Inside, every gear, spring, and lever is engineered to mechanical perfection. It requires no batteries, no firmware updates, and no digital processor (JavaScript). It functions purely through mechanical physics (CSS & HTML).
Many web developers find themselves frustrated by bloated frameworks that require 150KB of bundled JavaScript just to render a navbar, modal, or dropdown. If that JavaScript bundle fails to parse or conflicts with another script, the entire user interface breaks.
Bulma operates like that mechanical Swiss watch:
- It is 100% Pure CSS based entirely on modern Flexbox.
- It contains 0 bytes of JavaScript.
- Its classes are written in fluent, human-readable English (
button is-primary is-loading,column is-half is-offset-one-quarter). - It allows you to bring your own JavaScript engine (Vanilla JS, React, Vue, Svelte, Alpine.js) or rely completely on native HTML5 interactive primitives (
<details>,<dialog>).
Technical Deep Dive & Specifications
The Flexbox Column Layout Engine
Unlike Bootstrap’s negative margin row system, Bulma builds its layout grid around direct Flexbox containers:
<div class="columns is-variable is-4 is-multiline">
<div class="column is-8">8 of 12 (66.66%)</div>
<div class="column is-4">4 of 12 (33.33%)</div>
<div class="column is-one-third">1/3 (33.33%)</div>
<div class="column is-two-thirds">2/3 (66.66%)</div>
</div>
+-------------------------------------------------------------------------------+
| .columns (display: flex; margin: -0.75rem; flex-wrap: nowrap) |
| +-----------------------------------+ +----------------------------------+ |
| | .column.is-8 (width: 66.666%) | | .column.is-4 (width: 33.333%) | |
| | [ Main Feed Box ] | | [ Sidebar Box ] | |
| +-----------------------------------+ +----------------------------------+ |
+-------------------------------------------------------------------------------+
Sizing Options Reference
| Syntax Format | Examples | Compiled CSS Flexbox Width |
|---|---|---|
| English Fractions | .is-three-quarters, .is-two-thirds, .is-half, .is-one-third, .is-one-quarter |
width: 75%, 66.66%, 50%, 33.33%, 25% |
| 12-Column Scale | .is-12, .is-6, .is-4, .is-3, .is-2 |
width: 100%, 50%, 33.33%, 25%, 16.66% |
| Auto-Sizing | .column (without size modifier) |
flex-grow: 1; flex-basis: 0; (Equal distribution) |
| Narrow Width | .column.is-narrow |
flex: none; width: auto; (Fit content only) |
Responsive Modifiers
- By default,
.columnsstack vertically on mobile (<768px) and align horizontally on desktop (≥768px). .columns.is-mobile: Keeps columns side-by-side even on small mobile screens..columns.is-multiline: Allows columns to wrap onto multiple lines when total width exceeds 100%..column.is-half-tablet.is-one-third-desktop: Responsive sizing across device tiers (mobile,tablet,desktop,widescreen,fullhd).
The Modifier Syntax: .is-* vs. .has-*
Bulma enforces a strict linguistic naming convention:
BULMA MODIFIER CONVENTION
.is-* ---> State, Size, Color, Grid Behavior
Examples: .is-primary, .is-large, .is-active, .is-loading, .is-hidden
.has-* ---> Helper Properties, Typography, Alignment, Child Extensions
Examples: .has-text-centered, .has-background-white, .has-icons-left
Core Semantic Components
1. The .level (Flexbox Toolbar)
Designed for horizontal toolbars, navigation bars, and stats displays:
+-------------------------------------------------------------------------------+
| .level (display: flex; align-items: center; justify-content: space-between) |
| +---------------------------+ +-------------------------------+ |
| | .level-left | | .level-right | |
| | [.level-item] [.level-item] | [.level-item] [.level-item] | |
| +---------------------------+ +-------------------------------+ |
+-------------------------------------------------------------------------------+
2. The .media (Social Media Object)
A classic structural pattern for avatars alongside comments, tweets, or reviews:
+-------------------------------------------------------------------------------+
| .media |
| +--------------+ +--------------------------------------+ +-------------+ |
| | .media-left | | .media-content | | .media-right| |
| | [ 64x64 Img] | | <strong>Name</strong> @handle | | [ Delete X ]| |
| | | | Post content text here... | | | |
| +--------------+ +--------------------------------------+ +-------------+ |
+-------------------------------------------------------------------------------+
💻 Interactive Code Playground
Starter Code
Line-by-Line Code Breakdown
- Line 13 (
<section class="hero is-primary is-small">): Bulma’s signature banner component..is-primaryapplies the framework’s brand color palette, while.is-smallcontrols vertical padding. - Line 24 (
<nav class="level box">): The.levelcontainer uses Flexbox to align all child.level-itemnodes with equal spacing and centered vertical alignment. - Lines 57–63 (
<div class="column is-12-tablet is-8-desktop">): Fluid responsive column sizing: full width on mobile/tablets, shrinking to 66.66% on desktop screens. - Lines 67–88 (
<article class="media">): The pure CSS media object separates the left avatar (.media-left), main comment content (.media-content), and right action icon (.media-right). - Lines 100–108 (
<div class="field has-addons">): Glues an<input>and<button>together into a single connected UI control without any negative margin hacks.
Expected Browser Render Output
+-----------------------------------------------------------------------------------+
| DevOps Command Center |
| Pure CSS modular interface powered by Bulma flexbox. |
+-----------------------------------------------------------------------------------+
| [ Active Pods: 128 ] [ Cluster CPU: 42% ] [ Memory: 18.4GB ] [ Failures: 0 ] |
+-----------------------------------------------------------------------------------+
| [ Deployment Incident Log (is-8) ] | [ Instant Scale (is-4) ] |
| (O) Alex Rivera @arivera - 31m ago | Adjust replica count |
| Canary deployment for cluster verified... | [ 8 ] [ Scale Pods ] |
| [ Verified ] [ Canary-v2 ] | |
+-----------------------------------------------------------------------------------+🏋️ Hands-On Exercise
🎯 The Challenge: Build a Pure-CSS Discussion Thread
Instructions:
- Create a responsive discussion section inside a Bulma
.container. - Construct a Media Comment Item:
- Left side: 64x64 rounded user avatar (
image is-64x64,img is-rounded). - Content: User name in
<strong>, username in<small>, post text, and a tags container (tags) with status badges (tag is-warning,tag is-rounded). - Nested Media: Nest a second
.mediareply directly inside the.media-contentof the parent post.
- Left side: 64x64 rounded user avatar (
- Below the thread, create a comment submission form with
.field.has-addonscontaining a text input (is-expanded) and a submit button (button is-info).
🏁 Starter Code Sandbox
⚠️ Common Pitfalls
- Expecting Built-in JavaScript Functionality: Bulma does not include JavaScript. Toggling dropdowns (
.dropdown.is-active), burger menus (.navbar-burger.is-active), and modal dialogs (.modal.is-active) requires you to toggle the.is-activeCSS class yourself via vanilla JS or modern HTML primitives (<details>/<dialog>). - Forgetting
.is-multilineon Multi-Row Columns: If you define six.column.is-4elements inside a.columnswrapper without adding.is-multiline, Bulma will shrink all six columns onto a single row rather than wrapping them into two rows of three. - Confusing
.is-*with.has-*: Writingclass="has-primary"orclass="is-text-centered"will fail silently. Remember:.is-*denotes states and types (e.g.,is-primary,is-large), while.has-*denotes helpers and contents (e.g.,has-text-centered,has-icons-left).
💡 Pro Tips
- Pair Bulma with Native HTML5
<dialog>: Because Bulma has no JavaScript runtime, pair its modal styling with the native HTML5<dialog>element. You get full accessibility, automatic backdrop rendering, and ESC key dismissal natively while using Bulma for typography and layout. - Use
.is-vcenteredfor Form Control Alignment: When aligning labels, inputs, and buttons on the same row, add.is-vcenteredto the.columnscontainer to guarantee perfect vertical center alignment across varying element heights.
📌 Key Takeaways
- Bulma is a 0-JS, 100% Pure CSS framework built completely on modern Flexbox.
- The grid supports both English fractions (
is-half,is-one-third) and 12-column integers (is-6,is-4). - Semantic components like
.level(horizontal toolbars) and.media(nested avatars and comments) solve common layout patterns natively. .is-*modifiers control states, colors, and sizes;.has-*modifiers control text alignment, typography, and child helpers.- Adding
.is-multilineto.columnsis mandatory whenever columns sum to more than 100% width. - --