Skip to content
ThemesIonic — home
Web Design

Bootstrap and Tailwind in WordPress

Both frameworks work in a WordPress theme, and both collide with the block editor in their own way. The deciding question is who writes the markup — you, or the person editing the page.

5 min read advanced

A CSS framework assumes it controls the markup. WordPress does not give it that. Post content comes from the editor, plugins output their own HTML, and comment forms and widgets render markup you never wrote. Both Bootstrap and Tailwind work in a WordPress theme, and both spend their time negotiating with content they did not generate.

The choice between them is less about the frameworks than about that negotiation.

The two problems, named

Bootstrap's problem is collision. It ships opinionated component styles for elements the editor also styles — tables, forms, buttons, images. Block output lands in a page where .table and .btn already mean something, and the result is either double styling or a stack of overrides.

Tailwind's problem is discovery. It generates only the classes it can find by scanning your source files. Classes typed into post content, produced by a plugin or assembled at runtime are not in those files, so the CSS for them is never generated — and the page looks unstyled in exactly the places you did not anticipate.

Neither is fatal. Both need a deliberate answer before the first template is written.

Making Tailwind behave

  1. Scan the right sources. Templates, PHP files, and any JavaScript that composes class names.
  2. Never build class names dynamically from fragments — the scanner reads text, not intent.
  3. Safelist what content needs. If editors can apply a set of utility classes, that set must be explicitly protected from purging.
  4. Prefix the utilities if anything else on the page ships CSS, so text-center from two sources cannot mean two things.
  5. Style block output through a components layer, rather than expecting editors to type utilities into the editor.

That fifth point is the important one. Utilities in post content are a maintenance trap: the design lives in the database, not the theme, and changing it later means editing hundreds of posts. Keep utilities in templates and give post content semantic classes the theme styles.

Making Bootstrap behave

  1. Import only the parts you use rather than the whole bundle.
  2. Reconcile the block classes. WordPress emits wp-block-* classes; decide whether your theme styles those or maps them onto Bootstrap components.
  3. Rewrite the nav walker. WordPress menus do not emit Bootstrap's markup, so a custom walker is required for anything beyond a plain list.
  4. Watch the JavaScript. Bootstrap's components ship their own scripts and can collide with plugin scripts expecting a different version.

Bootstrap's advantage is familiarity: a team can pick up the theme and know what the classes mean, and that is worth real money on a project handed between developers.

Both need editor styles

Whatever you choose, the editor must load a stylesheet that makes content look the way it will look on the front end. Without it, editors compose pages in one design and publish another, and they will keep adding manual overrides to compensate — which is how custom CSS accumulates in a site until nobody can change anything safely.

This is the practical argument for keeping frameworks out of post content and in templates. The editor understands blocks; it does not understand your framework.

Weight, and what actually ships

Approach Typical shipped CSS
Full Bootstrap bundle Large, mostly unused
Bootstrap, imported selectively Moderate
Tailwind with correct scanning Small
Tailwind with an over-broad safelist Large
theme.json plus hand-written CSS Smallest

Tailwind's size advantage is real and conditional — it holds only when purging works, and purging is exactly what WordPress content makes difficult. A safelist added in frustration undoes it. Measure the built file rather than trusting the framework's reputation, and treat the result as part of page speed and render-blocking CSS.

The option that removes the question

For a block theme, theme.json already defines a palette, a type scale, spacing steps and layout widths, and — crucially — the editor knows about them. Editors pick from your design system inside the interface, and the output uses your tokens.

That is most of what a framework's utility layer provides, with none of the collision or purging problems, and it survives a theme change better because the tokens are in a format WordPress understands. What a block theme is and creating a block theme cover the route.

Use a framework anyway when the design system already exists in one — a company standardised on Bootstrap, or a codebase shared with a non-WordPress application. Consistency across products is a legitimate reason. Learning-curve familiarity, on a WordPress-only project, usually is not.

Where the design comes from

Whichever route, the framework is an implementation detail of a design system that should exist first: tokens, components, states. That handoff is the subject of Figma to WordPress, and the states people forget are enumerated in the responsive design checklist.

A build step also means the theme now has source files that are not the deployed files, which needs version control and a deployment path — see WordPress and Git. A theme requiring a build nobody documented is a theme the next developer cannot change.

Common mistakes

  • Shipping the entire framework because purging was never configured.
  • Utility classes in post content, putting the design in the database.
  • No editor stylesheet, so the editor lies about the result.
  • A custom menu walker skipped, leaving navigation styled by accident.
  • Adding a framework to a block theme that already had a working token system.

Verify

Build the theme and check the size of the CSS that actually ships. Open the editor and compare a paragraph, a heading, a list, a table and a button with the same markup on the front end — they should match. Then add a block the theme has never styled and see what happens: if it renders unstyled, your framework is not covering editor output, and that gap will appear on the first page someone else builds.

Frequently asked

Yes, with a build step. The complication is content scanning: Tailwind removes classes it does not find in your source files, and classes typed into post content or produced by plugins are invisible to it unless you account for them.
It works and it is easy to hand to a team, and its component classes collide with block editor markup in ways that need reconciling. It suits themes where the developer writes all the markup and editors only fill in content.
Often not. theme.json defines a palette, type scale and spacing steps that the editor understands and applies, which is the job a framework's utility layer was doing — and it works inside the editor rather than against it.
Tagged CSS

Related guides