Header Text: WordPress Custom CSS: Why Your Styles Vanish (& How to Fix It)

WordPress Custom CSS: Which Method Should You Use & When?

TL;DR: WordPress custom CSS lets you change your website’s appearance without editing theme files. The right method depends on your theme and what you want to change. Block themes use the Site Editor; classic themes use the Theme Customiser. CSS plugins and child themes suit more advanced or reusable styling. Most custom CSS usually survives updates, but styles added through the Site Editor or Customiser won’t carry over when you switch themes.

WordPress offers multiple ways to add custom CSS, and the right one depends on your theme and the size of the change. Block themes use the Styles panel in the Site Editor. However, classic themes use the Theme Customiser. Plugins and child themes are well-suited to reusable or developer-managed styling.

Each of those methods suits a different task, and choosing the incorrect one causes most of the styling headaches people run into. This guide explains what WordPress custom CSS is, when to use it, which method fits your situation, and how to keep your styling tidy as your site grows.

KEY TAKEAWAYS

  • Choose the method by theme type: Site Editor for block themes, Customiser for classic, plugins or child themes for managed code.
  • Custom CSS is tied to your active theme. It survives updates but clears when you switch themes.
  • When a style won’t apply, specificity is usually the cause. Check with browser DevTools before reaching for !important.
  • Keep CSS for presentation only, lean, accessible, and stored in a single documented place.

What Is CSS, & How Does WordPress Use It?

CSS stands for Cascading Style Sheets. It controls how your pages look, including colours, fonts, spacing and layout. HTML builds the structure of a page, CSS handles the presentation, and JavaScript adds behaviour, for example a menu that opens and closes.

The word “cascading” matters here. Styles arrive from several places and stack up in order: browser defaults first, then your theme, then block and plugin styles, and your custom CSS last.

Because it loads last, your CSS can override what came before. When two rules target the same element, the stronger one wins. That ordering is the cascade, and it’s why a style sometimes does nothing until you find what’s sitting on top of it.

WordPress Custom CSS: Which Method Should You Use and When? - How WordPress Uses CSS

What Is Custom CSS in WordPress?

WordPress custom CSS is any CSS you add yourself, on top of the styling that WordPress, your theme and your plugins already provide. It allows you to adjust the look of your site without waiting for a theme setting to catch up. You may change a button colour, tighten spacing, or style a single section.

When to Use Custom CSS, & When to Skip It

Custom CSS earns its place when you want a small, specific visual change the theme doesn’t offer. Common reasons include:

  • Matching buttons or headings to your exact brand colours.
  • Fine-tuning the spacing between sections.
  • Refining typography, for example line height or letter spacing
  • Styling a single button or call-to-action.
  • Fixing how something looks on smaller screens.
  • Creating a reusable class you can apply to many blocks.

However, some jobs are the incorrect fit. In that case, go for a built-in control instead.

For example, when:

  • The design option already exists in Global Styles or a theme setting.
  • You need the site to do something, which is a job for a plugin or code.
  • A section is laid out incorrectly, which the correct block or template fixes.
  • The effect you want needs JavaScript.
  • The underlying HTML is incorrect, so the markup needs to be corrected first.

If CSS would only hide a broken result, fix the cause instead.

How CSS Customisation Changed in Modern WordPress

WordPress handles CSS differently depending on your theme type, so it’s important to know which camp you’re in.

WordPress Custom CSS: Which Method Should You Use and When? - Classic Theme vs Block Theme Decision Flow for Adding Custom CSS

Classic Themes

Classic themes are the older style. You style them through the Theme Customiser, which is a live editor you can open by navigating to Appearance → Customise. These themes keep their main styles in a file called style.css and build pages with PHP templates. The Customiser includes an Additional CSS box for your own rules.

Block Themes

Block themes are the newer approach, built around the Site Editor. You style them visually through Styles and Global Styles, which set fonts, colours and spacing across the entire site, and each block carries its own controls. Behind the scenes, a file called theme.json holds the theme’s style settings. WordPress recommends using theme.json for standard block-theme styling where possible, because it works with the Site Editor and reduces specificity clashes.

Where WordPress Stores Custom CSS

Once you know your theme type, the next question is where to put your CSS. Modern WordPress offers it a few homes, each suited to a different scope.

WordPress Custom CSS: Which Method Should You Use and When? - How WordPress Custom CSS Is Stored

Site Editor CSS vs Theme Customiser CSS

On a block theme, your Additional CSS is in the Site Editor. WordPress 6.9 tucked these controls into the⁝ menu at the top of the Styles panel. Remember, only users with the correct permission can see this option, so a client account may not display it.

WordPress Custom CSS: Which Method Should You Use and When? - Access Additional CSS Settings in WordPress Block Theme

On a classic theme, you’ll use the Customiser instead. Go to Appearance → Customise → Additional CSS.

WordPress Custom CSS: Which Method Should You Use and When? - Open Additional CSS Settings in Classic Theme

The two work in a similar manner, so here’s how they compare side by side:

FactorSite EditorTheme Customiser
Main Theme TypeBlockClassic
Global Visual StylesYesDepends on the theme
Site-wide Additional CSSYesYes
Live PreviewYesYes
Tied to Active ThemeYesYes
Survives a Theme UpdateUsually, yesUsually, yes
Carries Over to a New ThemeNoNo

Site-Wide, Per-Block & Reusable CSS Classes

Not every style change needs to apply across your entire site. WordPress lets you set the scope, so a rule can cover everything or just one spot.

Site-wide CSS suits styling that repeats across the site, for example, your brand colours. You add it through the Additional CSS box above.

Per-block CSS targets a single block. To do this, you open the block, find Advanced in its settings, and use the ADDITIONAL CSS field. You add the property and value only, with no selector required, so color: red; turns that block’s text red.

A reusable CSS class suits styling you wish to apply on demand. In the same Advanced section, the ADDITIONAL CSS CLASS(ES) field lets you add a class name. You write the rule once, then apply the class to any WordPress block that requires it.

WordPress Custom CSS: Which Method Should You Use and When? - Additional CSS & Additional CSS Classes (es)

Additional CSS vs theme.json

These two serve different requirements. WordPress Additional CSS accepts any CSS you write, which makes it quick and good for targeted overrides. However, theme.json is a structured settings file that defines global and block styles in a clean, predictable manner.

For block-theme work, WordPress recommends the styles section of theme.json where possible. It keeps styling in one place and avoids the specificity conflicts that a loose CSS can cause. Additional CSS still suits quick fixes, while theme.json suits styling that ships as part of a theme.

All Methods at a Glance

MethodBest UseAdvantagesLimitation
Site EditorSite-wide CSS on a block themeBuilt in, live previewTied to the current theme
Block CSSOne block or block typePrecise scopeHarder to track as it grows
CustomiserSite-wide CSS on a classic themeBuilt in, live previewMissing on some block themes
PluginSnippets managed on their ownCentral control, easy to toggleAdds a dependency
Child themeDeveloper-managed theme stylingWorks with version controlNeeds more technical skill

Child Theme or CSS Plugin: Which Fits?

A child theme is a small theme that sits on top of your parent theme and safely contains your changes. You can save your child theme CSS here when styling is part of a bigger custom build.

It fits when:

  • You’re building a custom theme from the ground up.
  • You use version control, for example Git, to track changes.
  • You’re also customising templates or PHP.
  • An agency or developer owns the site’s upkeep.

A child theme is overkill for a single colour change, so use it for work that belongs in the theme layer. Our guide on creating a WordPress child theme (add a link to this tutorial) explains the setup.

A CSS plugin like SiteOrigin CSS stores your snippets separately from the theme. This suits sites where a non-technical admin manages the styling.

A plugin works well when:

  • You want snippets you can switch on or off easily.
  • The people managing the site aren’t comfortable with code.
  • You want your WordPress custom CSS to stay put even if the theme changes.
  • The styling should be in one central place.

Here, the trade-off is dependency. Your CSS now relies on that plugin staying active and maintained. If it’s disabled or abandoned, your styles go with it.

Does Custom CSS Survive Updates & Theme Switches?

Updates and theme switches are two different events, and your WordPress custom CSS behaves differently in each. An update changes software you already run, while a switch swaps your entire theme for a new one. Here’s what happens to your CSS in both cases:

Through Updates

This is where many site owners are caught out. A WordPress core update won’t touch any CSS you added through the Additional CSS box or a properly set up child theme, and a plugin update won’t remove it either. A theme update is safe too, if your CSS lives in Additional CSS or a child theme rather than inside the parent theme’s files.

When You Switch Themes

Switching themes is a different story. WordPress stores Additional CSS against the active theme. The official documentation is clear: your CSS won’t be overwritten by a theme update, but it will be cleared when you switch themes.

So, when you move to another theme, the CSS you added through the Site Editor or Customiser does not carry over. This applies to both block and classic themes.

Also, carrying it over blindly would cause problems anyway. A new theme has different class names, markup, layout and CSS variables, so styles written for the old theme would often target elements that no longer exist. So, treating a theme switch as a clean slate is the safer approach.

Why Isn’t My WordPress Custom CSS Working?

You’ve added your CSS, saved, and nothing changed. Three things explain most of these moments:

  1. Specificity.
  2. The overuse of !important.
  3. Not checking what the browser is really doing.

Let’s go through each of them below:

WordPress Custom CSS: Which Method Should You Use and When? - CSS Cascade & Specificity Flow

CSS Specificity Without Headache

Specificity decides which rule wins when two rules target the same element. The browser scores each selector and applies the strongest one.

The basic order is easy to picture. For instance, an element selector p is the weakest. A class selector, for instance .intro, beats it. An ID selector, for example #header, beats both. So, if p sets your text grey and .intro sets it blue, a paragraph with the .intro class turns blue, even if the grey rule was written later.

That order handles most cases, but the full cascade considers a few more things:

  • Origin: Where the style comes from. For example, the browser, the theme, or you.
  • Cascade Layers: A newer way themes can group styles to decide which group wins.
  • Specificity: The selector score explained above.
  • Source Order: When two rules score the same, the one written later wins.
  • Inheritance: Some styles pass down from a parent element to the ones inside it.

You don’t need to work the maths out by hand. Just remember the rule of thumb: when a style won’t apply, something more specific is usually overriding it. Your browser’s developer tools, which we’ll cover next, show you exactly what.

Why !important Shouldn’t Be Your First Fix

When a style won’t apply, it’s easy to add !important to force it. This works, but it stores up trouble. It makes your CSS harder to maintain and can start an escalation battle when you pile more !important rules on top of each other. Worst of all, it hides the real issue, which is usually a selector that isn’t specific enough.

With that said, there are times !important is the correct call. For example, overriding a stubborn plugin style you can’t reach another way. So, use it on purpose, once you understand why a rule isn’t applying.

Diagnosing With Browser DevTools

Your browser’s developer tools are the fastest way to see what’s going on. Right-click an element and choose Inspect to open them. From there, you can read the element’s classes and computed styles, and spot which properties are being overridden.

Overridden rules appear with a line through them, so you can see which one is winning. You can also make temporary edits to test a fix before you write it, and the responsive view shows how your CSS behaves on smaller screens.

WordPress Custom CSS: Which Method Should You Use and When? - Diagnose WordPress Custom CSS with Web Browser DevTools

If a style still won’t behave after checking all this, contact Domains.co.za support. Our team can help you track it down.

Custom CSS, Responsive Design & Accessibility

WordPress Custom CSS changes more than how your site looks. It also decides how well your pages work on small screens and how easily everyone can use them. Here’s how:

Responsive Design

Most South African visitors browse on their phones, so your CSS needs to work on small screens first. To do this, start with a layout that flexes to fit the space, using relative sizes instead of fixed widths. That way your design bends to the screen rather than breaking on it.

Then add a media query only where a layout truly needs to change at a certain width. A media query is a CSS rule that applies styles at a given screen size. A mobile-first approach (styling for small screens first and adding rules for larger ones) usually stays cleaner than patching a desktop design with dozens of breakpoints. Also, test on real devices when you can, since a phone can behave differently from a desktop preview.

Accessibility

CSS shapes how usable your site is, so a few WordPress CSS best practices matter. For example:

  • Keep enough colour contrast between text and its background.
  • Keep visible focus states, so keyboard users can see where they are.
  • Set comfortable font, font sizes and line height, so text is easy to read.
  • Be careful when hiding things. The display: none rule removes content for everyone, including screen readers, so use it only when you mean to.
  • Avoid effects that only work on hover, since people on touchscreens can’t hover.
  • If a visitor asks their device to reduce motion, respect that setting.
  • And don’t remove focus outlines just to make a page look neater. They show keyboard users where they are on the page, so taking them away leaves those visitors stuck.

Does WordPress Custom CSS Affect Performance & SEO?

Performance

On its own, custom CSS doesn’t slow WordPress down in any way that matters. The trouble starts when your CSS gets out of hand.

Speed suffers when a stylesheet becomes very large, when several frameworks repeat the same rules, or when render-blocking stylesheets pile up. A render-blocking stylesheet is one the browser must load before it can show the page, so the more you stack, the longer visitors wait. Unused CSS also adds weight, as do extra external fonts.

Keeping your CSS lean pays off most on mobile data, which many South African users rely on. And don’t judge speed by the number of plugins alone, since that count doesn’t tell you how heavy each one really is.

SEO

WordPress Custom CSS doesn’t directly push a page up the rankings. There’s no CSS trick that earns a higher position. It can affect SEO indirectly, though. For instance, poor CSS can harm usability, break your mobile layout, or drag down Core Web Vitals, the speed and stability scores Google measures. It can also harm accessibility or hide content in ways search engines dislike.

Common WordPress Custom CSS Mistakes

A few habits cause most custom CSS headaches. Watch for these:

  • CSS Rules spread across the Customiser, a plugin, block settings and theme.json, with no note of what sits where. Choose a home and record it.
  • The same style written in two places, then fighting itself.
  • Styling every p or every h2 when you meant one section. Ensure you choose CSS selector(s) correctly.
  • Styling fragile markup. Block output includes classes, such as wp-block-image, that can change across WordPress versions. CSS tied too tightly to them can break on an update.
  • Forgetting the cache. If a change doesn’t show, your caching plugin or host cache is often the reason. Our guide on clearing the WordPress cache (add a link to this tutorial) shows how.

A few more traps appear in earlier sections, such as using !important as a quick fix, forgetting how a design looks on a phone, and expecting your WordPress custom CSS to carry across when you switch themes. All three are easy to avoid once you know to watch for them.

How South African Agencies Should Manage Custom CSS

If you manage WordPress sites for clients, custom CSS requires a clear system behind it. Use a child theme for larger custom projects, so the CSS ships with the theme. Keep everything in version control, for example Git, so you can track and roll back changes. Test on a staging site before touching the live one. Reliable WordPress Hosting in South Africa with staging support helps during load-shedding, when a rushed live edit can go wrong halfway through.

Comment your CSS so the next person understands it, and agree on naming conventions. Keep a change log and record one documented location for the CSS. When you hand a site over, include notes on where the styling is, and clear out legacy CSS you no longer require.

How Do You Add Custom CSS to WordPress?

First, check whether you have a block theme or a classic theme. For most changes, use the native tools: the Site Editor Styles panel for block themes, or the Customiser for classic ones. Use block-level CSS for a single, isolated change, and a plugin or child theme for managed custom code. Then, test the result on both desktop and mobile.

For the full step-by-step explanation, see our guide on how to add custom CSS to WordPress (add a link to this KBA).

Strip Banner Text - Style your WordPress site on hosting built for South Africa, backed by local, WordPress-trained support. [Get Started]

Power Up Your Site: How to Install a WordPress Plugin

VIDEO: Power Up Your Site: How to Install a WordPress Plugin

FAQS

Is custom CSS safe in WordPress?

Yes, when you add it correctly. Using the WordPress CSS editor box (Additional CSS) or a child theme means a WordPress update won’t remove it. The main risk is directly editing parent theme files, as a theme update can overwrite them. Stick to the supported methods, and you’re fine.

Where is Additional CSS in WordPress now?

In a block theme, open the Site Editor by navigating to Appearance → Editor → Styles → three-dot menu, and choose Additional CSS. WordPress 6.9 moved the controls into that menu. In a classic theme, find it under Appearance, then Customise, then Additional CSS.

Does WordPress still have the Theme Customiser?

Yes. Classic themes still use the Theme Customiser under Appearance → Customise, including its Additional CSS box. Block themes use the Site Editor instead. The tool your site shows depends on the theme you have active.

Does custom CSS survive a theme update?

Usually, yes. CSS stored in the Additional CSS box or a properly set-up child theme survives both core and theme updates. The exception is CSS written directly into a parent theme’s files, which an update can wipe.

What happens to CSS when I change themes?

It doesn’t carry over. WordPress ties Additional CSS to the active theme, so switching themes clears it from the new one. A new theme has different markup and class names, so old CSS would often miss its targets anyway. Treat a switch as a clean slate.

Is a CSS plugin better than a child theme?

Neither is better overall; they suit different requirements. A plugin is handy for non-technical users who want simple on-off snippets. A child theme suits developer-managed projects that use version control. Select the plugin for simple central management, and the child theme when CSS belongs in the theme layer.

Can I add CSS to only one WordPress block?

Yes. Select the block, open its Settings, and expand the Advanced section under Block attributes. The ADDITIONAL CSS field styles that block, and you add only the property and value, with no selector required. You can also add a class in ADDITIONAL CSS CLASS(ES) to reuse a style across blocks.

Does custom CSS affect site speed?

Not on its own. A small amount of custom CSS has no real effect on speed. Slowdowns come from very large stylesheets, duplicated rules, render-blocking files or heavy unused CSS. Keep your CSS lean, and it won’t hold your site back.

Other Blogs of Interest.