Table of Contents

03. Blocks, Elements, and Modifiers — A Mental Model for Components

How 'naming' expresses structure,
intent, and clarity

—Part of CSS Primer for the AI Era — Structure

Components are easier to understand when
their 'internal structure' is expressed clearly.
This also makes it easier for AI to work with them.

One of the simplest ways to think about structure
is the
Block / Element / Modifier
'mental model'.

'BEM' is not a rule
or a methodology to memorize.
It is, rather, a way of thinking about
components as 'shapes'
with parts and variations.

The BEM visual mental model:

A 'block' is a thing.
An 'element' is a part of the thing.
A 'modifier' is a variation of the thing
.

This model gives humans and AI
a 'shared language' for describing structure.


1. Blocks — Self‑Contained Components

A 'block' is a standalone component —
a meaningful piece of UI that can exist on its own.

Examples:

A block:

A block is the root of a component.

A quiet principle:

If it can stand alone,
it is a block
.


2. Elements — Parts That Belong to the Block

An element is a part of a block —
something that only
makes sense inside that block.

Examples inside a card block:

Examples inside a nav block:

Some characteristics of Elements:

A simple rule:

If it is part of the block’s internal structure,
it is an element
.


3. Modifiers — Variations of a Block or Element

A modifier expresses a variation —
a change in appearance, tone, or behavior.

Examples:

Modifiers:

A simple truth:

Modifiers express difference without
breaking the component
.


4. Why This Mental Model Matters

This model gives us (and AI):

It also helps AI understand:

AI does not infer structure.
It needs humans to express it.

A quiet reminder:

AI can style a component beautifully
but only when
the structure is clear
.


5. Blocks, Elements, and Modifiers in Practice

Let’s take a simple example: a card.

Block

<div class="card">

Elements

  <div class="card__header">...</div>
  <div class="card__body">...</div>
  <div class="card__footer">...</div>
</div>

Modifier

<div class="card card--highlighted">

This structure tells AI:

It also makes CSS simpler, clearer, and more maintainable.


6. This Is a Mental Model, Not a Rule

This is not about strict naming conventions.
It is about thinking in components.

We can adapt the naming:

The model remains the same:

A simple truth:

The names can change.
The thinking stays the same
.


7. Why This Matters in the AI Era

AI does not “see” the whole codebase.
It only sees what we show it.

Clear structure helps AI:

Humans provide the shape.
AI fills in the details.

A quiet reminder:

Structure is guided by human judgment.
Style becomes collaborative
once the structure is understood
.


*Suggested Next Reading: Naming and Shape: How Structure Supports Style


Tony de Araujo —New York | Lisbon