Setup & site building · Guide
How to Add Custom CSS in WordPress

Short answer
Add custom CSS in WordPress with the built-in Additional CSS field: in a classic theme go to Appearance, then Customize, then Additional CSS; in a block theme go to Appearance, then Editor, then Styles, then Additional CSS. The CSS loads after the theme's CSS, survives theme updates, and is tied to the active theme.
Key takeaways
- Additional CSS has been built into WordPress since version 4.7 and needs no plugin.
- Classic themes keep Additional CSS in the Customizer; block themes keep it under Styles in the Site Editor.
- Custom CSS loads after the theme's CSS, so it can override theme rules, and it survives theme updates.
- A site-wide custom CSS editor was added to the Styles interface in WordPress 6.2.
- Per-block CSS in Styles uses the property: value format, with no selector or curly braces.
What is the best way to add custom CSS in WordPress?
Use WordPress's own Additional CSS field: the Customizer for a classic theme, and Styles in the Site Editor for a block theme.
Additional CSS has been built into WordPress since version 4.7, and it needs no plugin and no theme file edits. The WordPress CSS handbook states that you can add custom CSS from the Appearance Customize screen without extra plugins or direct theme edits, as explained on Developer WordPress.
CSS added this way loads after the theme's own CSS, so it can override the theme's rules without you writing a whole stylesheet. It also survives theme updates, which is the main reason to use it instead of editing the theme's style.css file.
The one limit to know: Additional CSS is tied to your theme. If you switch themes, the old rules stop applying, and they return only if you switch back.
| Where the CSS goes | Route |
|---|---|
| Whole site, classic theme | Appearance, then Customize, then Additional CSS |
| Whole site, block theme | Site Editor, then Styles, then Additional CSS |
| One block only | The block's settings, then Additional CSS |
| Every block of one type | Site Editor, then Styles, then Blocks, then Additional CSS |
| Long-term CSS in files | Child theme stylesheet, or theme.json under styles.css |
How do you add custom CSS in a classic theme?
Go to Appearance, then Customize, click Additional CSS, type your CSS, check the live preview, and click Publish.
Follow these steps:
- Go to Appearance, then Customize, to open the Customizer.
- Click Additional CSS at the bottom of the menu.
- Type or paste your CSS into the code field.
- Check the live preview on the right side of the screen.
- Click Publish.
The Customizer shows your changes in the preview before anything goes live, so you can adjust a rule and see the result at once. SiteOrigin's custom CSS guide notes that the preview updates as you type, and that the Customizer marks a line with a mistake and blocks Publish until you fix it.
Only administrators can use Additional CSS by default, as the same SiteOrigin guide states. If the field is missing for your account, check your user role first.
How do you add custom CSS in a block theme?
Go to Appearance, then Editor, open Styles, open the three-dot menu, choose Additional CSS, type your CSS, and click Save.
Block themes keep Additional CSS under Styles in the Site Editor, not in the Customizer. WordPress.org's Styles overview states that a site-wide custom CSS editor is built into the Styles interface, as of WordPress 6.2, and that any CSS added there applies across the whole site.
The same page notes that in WordPress 6.9, the Additional CSS controls moved into the ellipsis menu in the header of the Styles page. If you run an older version, the control may sit in a different spot in the Styles panel, so check your version if the menu looks different.
Styles needs a block theme and WordPress 5.9 or higher, as the Styles overview states. The guide to what a block theme is explains how to tell whether your theme is a block theme.
How do you add CSS to one block only?
Select the block, open Advanced in the block settings sidebar, and type the CSS properties into the Additional CSS field.
This field takes properties only, not a selector. SiteOrigin's custom CSS guide gives the example of typing color: #1e5a8c; to change the text color of the selected block. WordPress applies it to that block alone.
Save the post, page or template after you add the rule. A few blocks, such as Custom HTML and Shortcode, have no Additional CSS field, so this route is not open for them.
Use this route for a one-off change, such as a single heading that needs a different color. For a change that should apply to every block of the same type, use the Styles route in the next section instead.
How do you add CSS to every block of one type?
In the Site Editor, open Styles, then Blocks, pick the block type, and add your CSS in its Additional CSS area.
WordPress.org's Styles overview states that each block under Styles, then Blocks, has an Additional block CSS section, and that CSS added there applies only to that block type across the whole site. The same page notes that you should follow the property: value format here, with no selector or curly braces.
For example, opening Blocks, then Button, and adding a rule there changes every Button block on the site at once. That beats editing each button one by one, and it keeps the change in one place.
Start with the options already in Styles before you add custom CSS. WordPress.org's Styles overview advises starting with the built-in color, typography and layout options, and using custom CSS only for the gaps those options do not cover.
How do you find the right selector for your CSS?
Open your browser's Inspect tool, click the element you want to change, and copy the class name WordPress or your theme gave it.
WordPress and themes add class names to most parts of a page, such as .site-title for the site title or .wp-block-button for buttons. Those class names are what your CSS selector targets.
A simple rule has three parts: a selector, a property and a value. For example, this rule makes the site title larger:
.site-header .site-branding .site-title {
font-size: 36px;
}
SiteOrigin's custom CSS guide uses this same example for the site title. If your theme uses a different class for the site title, the rule will not match, so check the class in Inspect first.
Avoid very broad selectors such as p or div on their own, since they change every matching element on the page. Target the class of the part you want to change, and no more.
How do you add custom CSS with a child theme or theme.json?
Put long-term CSS in a child theme's stylesheet, or in theme.json under styles.css for a block theme.
A child theme suits a large set of CSS rules that you want in files you can copy and back up. The guide to what a child theme is explains the child theme setup.
The guide to using theme.json covers the block theme settings file.
For block themes, WordPress added a styles.css property to theme.json, which holds custom CSS as part of the theme's global styles.
The Make WordPress Core post on custom CSS for global styles states that this CSS is specific to the current theme, and that the & character works for nested elements and pseudo-selectors in both theme.json and the global styles CSS field.
The same post notes that per-block custom CSS arrived in WordPress 6.2, both through the Styles interface and through theme.json. Use theme.json when the CSS belongs with the theme itself, and use Additional CSS when it belongs with the site.
How do you check your CSS worked?
Save the CSS, open the page in a private browser window, and confirm the change appears.
A cached page is the most common reason CSS looks missing after you save. Clear your page cache, your host cache and your browser cache, then reload. The guide to fixing CSS changes that do not show covers the cache checks in order.
Check the change on a phone as well as a desktop screen, since a rule that looks right on a wide screen can break a narrow one. If the rule has no effect, open Inspect and check whether another rule with a more specific selector is overriding it.
If Additional CSS is empty after you switch themes, that is expected: the rules stay with the old theme. Copy them into the new theme's Additional CSS field if you still need them.
What mistakes should you avoid?
Do not edit the parent theme's style.css file, do not use selectors you have not checked, and do not paste CSS you do not understand.
The WordPress CSS handbook gives two reasons to use Custom CSS instead of editing a theme directly: your changes are lost when the theme updates, and Custom CSS loads after the theme's CSS so it can override rules cleanly. That is stated on Developer WordPress.
Other mistakes to avoid:
- Adding
!importantto every rule, which makes later fixes harder. - Styling every element on the page with one broad selector.
- Copying CSS written for a different theme without checking the class names.
- Adding dozens of rules to Additional CSS when a child theme file would be easier to manage.
Keep your CSS short and named for what it does, and remove rules you no longer need. A small, tidy set of rules is easier to fix than a long list of half-remembered tweaks, and the guide to removing unused CSS in WordPress shows how to trim what is left over.
Frequently asked questions
Where is the Additional CSS field in WordPress?
Additional CSS has been built into WordPress since version 4.7. Classic themes keep it in the Customizer, and block themes keep it under Styles in the Site Editor. No plugin is needed for either route.
How do I add CSS to just one block?
In the block editor, select the block and open Advanced in the block settings sidebar, then type the properties into the Additional CSS field, for example color: #1e5a8c. A few blocks, such as Custom HTML and Shortcode, have no Additional CSS field.
Does custom CSS disappear when I change themes?
Yes. Additional CSS is tied to your theme, so the rules stop applying when you switch themes and return if you switch back. Copy the rules into the new theme's Additional CSS field if you still need them.
Why is my custom CSS not working?
Custom CSS loads after the theme's CSS, so it can override theme rules. Check that your selector matches the class on the page, clear the page cache, and look for a more specific rule overriding yours in the browser's Inspect tool.
How do I style every button the same way?
In the Site Editor, open Styles, then Blocks, pick the block type, and add your CSS in its Additional CSS area. Use the property: value format with no selector. The rule then applies to every block of that type across the site.
Should I edit my theme's style.css file directly?
Yes, by editing the parent theme's style.css file, which a theme update will overwrite. Use Additional CSS for small changes, or a child theme's stylesheet for a large set of rules that you want in files you can copy and back up.
Sources
- CSS WordPress Developer Resources
- Styles overview WordPress.org
- How to Add Custom CSS in WordPress SiteOrigin
- Custom CSS for global styles and per block Make WordPress Core
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


