Want to try editing WordPress CSS, but no idea where to start? With CSS styling, you can edit your siteâ€™s appearance globally or on certain pages. Add colors, space out certain elements, design a layout, and basically change exactly how anything in your WordPress theme looks.
If you want to get more familiar with WordPressâ€™ development environment, or just have finer control over your websiteâ€™s appearance, youâ€™ll need to know how to add CSS in WordPress (plus how to change whatâ€™s already there).
By editing your theme and including additional CSS of your own, youâ€™ll be able to optimize each and every visual element on your site. Today, weâ€™ll take a closer look at it.
Ready to start? Letâ€™s do it!
What Is CSS Editing?
CSS stands for Cascading Style Sheets and itâ€™s the most popular web language besides HTML. The two of them go hand-in-hand, as CSS is used to style HTML elements. HTML lays the groundwork of a websiteâ€™s appearance and CSS is used to further style it.
But even if youâ€™re not a web designerÂ or developer, itâ€™s good to pick up a little CSS, as you can use it to move or style elements on your website, or make small aesthetic changes to your theme to better suit you.
WordPress and CSS
Within WordPress, CSS is a little bit different. Itâ€™s controlled by themes, which are made up of template files, template tags, and of course the CSS stylesheet. Though generated by your theme, all of these are editable by you.
Template files split parts of your website into sections (such as header.php or archive.php), and template tags are used to call on them and other content from your database. These files are actually made up of mostly PHP and HTML, though you could add CSS if you needed to.
How to Customize Your WordPress Theme with CSS
If you want to customize your theme and change how your site looks with CSS, youâ€™ll need to either add your own code or edit whatâ€™s already there. There are ways to add CSS without ever needing to touch any theme files but to change existing theme code, youâ€™ll have to access your siteâ€™s stylesheet.
As you make these changes, thereâ€™s one thing you should know: when your theme updates, any edits youâ€™ve made to style.css, functions.php, or other theme template files will be erased. In general, you shouldnâ€™t be making direct changes to your website in the editor without using a child theme.
The stylesheet is like a â€œlist of instructionsâ€ for your website, setting exactly how itâ€™s styled and how the CSS code is handled. This is where youâ€™ll do the bulk of your editing, but weâ€™ll also show you how to access other theme template files, such as header.php and footer.php.
Not comfortable doing this yourself? Consider hiring a WordPress developer to handle that step for you.
Editing WordPress CSS in the Dashboard
The easiest and most convenient way to access your CSS stylesheet is right in the WordPress dashboard. No need to install FTP programs or code editors. You can directly edit any file with syntax highlighting and function documentation built in.
Before you do any major edits to core files, you should always backup your WordPress site. Itâ€™s very easy to accidentally make a mistake that could break your siteâ€™s appearance if youâ€™re new to CSS, and it could be difficult to figure out how to revert your changes.
Once youâ€™ve made a backup and a child theme, log in to your backend. You can find the editor by going to the menu and clicking Appearance > Theme Editor.
You should see a popup warning you against making direct edits to these files. Donâ€™t worry, just click â€œI understandâ€. Itâ€™s only a warning to use a child theme and backup your website before you make any major changes. Follow those steps, and itâ€™s safe to edit.
And now youâ€™re in! You should be on the stylesheet by default but look to the menu on the right to view your theme files if not.
Besides style.css, youâ€™ll also have access to template files like functions.php, header.php, and single.php. All of these affect how certain pages on your site act.
But you should familiarize yourself with PHP before diving into these particular files.
Just remember: most CSS changes you make here will be global. For instance, if you change your H1 headers to a certain font, it will take effect for every single page on your site. Youâ€™ll need to use special syntax to customize specific pagesâ€™ styling.
Edit Theme Files Directly
What if you canâ€™t access the Theme Editor or prefer to do your work over FTP? Itâ€™s easier to use the backend editor, but some themes or plugins may disable it. If thatâ€™s the case, youâ€™ll need to connect to your website through FTP.
FTP, or File Transfer Protocol, allows you to remotely access and modify a websiteâ€™s files. The first thing youâ€™ll need to do is download FileZilla or any other FTP client.
Next, you should contact your host and ask for your FTP credentials (host, port, and username/password if applicable). If your host has a dashboard, you might be able to find them by logging in.
Kinsta usersâ€™ credentials are located in the MyKinsta dashboard under Sites > SFTP/SSH.
Once you have them, launch your FTP client and enter that information. If it doesnâ€™t work, try putting â€œsftp://â€ before the URL in the Host section.
Once youâ€™re in, you can find your style.css file by clicking the wp-content folder to open it, then your themeâ€™s folder (like the Twenty Twenty theme), then scrolling until you see style.css.
Double click to open it (or right-click and select View/Edit) and make your modifications. Remember to save and upload back to the server.
If you need to edit other template files like home.php, single.php, archive.php, you can find them in the same folder as style.css.
Editing your theme files, whether through FTP or the dashboard, isnâ€™t always necessary. In fact, itâ€™s better to avoid doing it if youâ€™re just adding some extra code.
For small additions, hereâ€™s the best way to add CSS to your WordPress site.
How to Add Custom CSS in WordPress
If youâ€™re not looking to edit the existing CSS code, and just want to add your own styling instead, itâ€™s strongly suggested to use one of the following methods: WordPress customizer or using a dedicated plugin.
For one,Â the CSS code added through one of these methods itâ€™s a lot easier to access and use. You donâ€™t need to worry about putting your new CSS in the wrong place or forgetting where you added it if you want to make modifications later.
Also, CSS added through one of these methods wonâ€™t be lost when your theme updates (though it may still disappear if you change themes).
This means you donâ€™t need to use a child theme, and if something breaks, all you have to do is remove the CSS you just added.
Do note that you should still keep a backup of your website, as some people have reported occasionally losing their CSS during major updates. Still, this method is a lot more reliable than directly editing theme files.
While you can just add code to style.css and call it a day, if you donâ€™t want to create a child theme, make major edits to existing CSS in your theme, and potentially end up with all your work erased, itâ€™s best to either use the Additional CSS option in the WordPress customizer or install a plugin.
1. Editing CSS Through WordPress Customizer
Instead of using the Theme Editor, try this. Log in to your WordPress backend and click Appearance > Customize to open the theme customization screen. Youâ€™ll see a live preview of your website, with options on the left to customize elements like the colors, menus, or other widgets.
At the very bottom of this menu, you should find the Additional CSS box.
Click to open it. Youâ€™ll be taken to a new screen with a code input box and a few instructions. The Additional CSS screen includes syntax highlighting, just like the Theme Editor, along with validation that lets you know if your code is wrong.
Any code you write automatically appears in the preview area on the right unless it has an error (though you can choose to publish it anyway).
When youâ€™re done working, you can publish your code, schedule when it will take effect, or save it as a draft to work on later. You can even get a preview link to share with others.
As you can see, the Additional CSS page is in many ways more powerful than the Theme Editor, and much more suited to adding code than messing with core files.
The CSS code you write here overwrites the default styling of your theme and it doesnâ€™t disappear when your theme updates. If you canâ€™t see it â€œliveâ€ on your preview, double-check youâ€™re using the correct selectors in your CSS code.
Just like with the Theme Editor, CSS is global by default, but you can write code that targets specific pages.
The one downside is that, should you switch themes, anything youâ€™ve written will be erased. Make sure to back up your CSS before moving to a new theme or you might end up losing a lot of work.
If youâ€™re struggling to use this option, or want a solution that works across themes and can more easily target certain pages, you should try a plugin instead.
2. Adding Custom CSS to WordPress Using Plugins
There are a few reasons you might want to use a plugin to add CSS to WordPress. While the function is similar to the Additional CSS menu, styles will usually stick even if you switch/update themes.
Need a blazing-fast, secure, and developer-friendly hosting for your client sites? Kinsta is built with WordPress developers in mind and provides plenty of tools and a powerful dashboard. Check out our plans
You may also enjoy their UI more, or like the extra features like autocompletion. Some plugins even let you build CSS through dropdown menus, rather than having to write it yourself.
Simple Custom CSS
Simple Custom CSS is the most popular CSS editor plugin, due to its ease of use, minimal interface, and lightweight backend. In short, itâ€™s a very small WordPress plugin that packs a big punch.
Setting up is a breeze and youâ€™ll see no negative impact on performance. It works on any theme and includes syntax highlighting and error checking.
Simple Custom CSS and JS
Simple Custom CSS and JS is a good alternative. It also lets you target the header, footer, frontend, or even the admin backend.
WP Add Custom CSS
If youâ€™re struggling to add CSS to specific pages, WP Add Custom CSS adds a custom CSS box to the editing screen, and also comes with global styling.
You may also want to consider trying a visual CSS editor. These take all the complicated coding and turn it into a series of easy-to-use input fields and dropdown menus which handle all the programming for you.
CSS Hero is a premium visual editing plugin with some seriously powerful features (animation, device-specific edits, and non-destructive editing to name a few).
Where to Learn CSS
Ready to dive into CSS for yourself? These beginner tutorials will establish the basics and teach you the syntax youâ€™ll need to know to write your own functional CSS code.
It can be daunting, but unless youâ€™re trying to do something really advanced, CSS isnâ€™t too hard! Simple things like changing the background color or setting font styling are fairly easy, and there are plenty of examples online.
Here are a few examples covering the best CSS tutorials for beginners.
- W3Schools CSS Tutorial: There is an absolute ton of information to be found here: in-depth tutorials, examples, and references for you to work with. W3Schoolsâ€™ tutorials are as simple and easy to follow as possible, so even if youâ€™re a total beginner, this is a great place to start.
- Codeacademy Learn CSS: Through six free hands-on lessons, youâ€™ll learn the basics of CSS. This is no simple video tutorial, but an interactive lesson that has you working with actual code. With the pro version, you also get quizzes and freeform projects to work on.
- Learn CSS in One Hour: Plenty of people want to learn a new programming language, but they just donâ€™t have the time to dedicate. But if you can set aside just one hour, you can learn CSS with this free 20-part course. Even if youâ€™re not a master by the end, you should have a good grasp of the basics.
- Introduction to Basic HTML & CSS for WordPress Users: Looking for something specific to WordPress? If youâ€™ve always struggled with writing HTML and CSS, this course is perfect for you. Itâ€™s paid, but comes with 52 lectures and five hours of video to learn from.
As a WordPress user, jumping into CSS might be confusing at first. But once you know how to edit your theme files and where to add styling, you should have no more trouble.
Theme files can be edited either from your backend or through FTP to change your siteâ€™s appearance, but this should usually be avoided unless you need to edit the existing code.
If you just want to add your own CSS, use the Additional CSS page under Appearance > Customize, or try a plugin if you need something more powerful.
Edits to your stylesheet will be lost upon theme update unless you use a child theme. The same isnâ€™t true for Additional CSS. Your code is safe from updates but donâ€™t forget: only a plugin will retain CSS when you change themes.
Whatever method you choose, you should always keep regular backups of your website, including the stylesheet and custom code youâ€™ve added. Now itâ€™s time to brush up on your CSS basics using the resources we provided.