{"id":143606,"date":"2015-08-08T11:00:12","date_gmt":"2015-08-08T15:00:12","guid":{"rendered":"http:\/\/premium.wpmudev.org\/blog\/?p=143606"},"modified":"2022-03-14T23:42:07","modified_gmt":"2022-03-14T23:42:07","slug":"custom-css-wordpress","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/custom-css-wordpress\/","title":{"rendered":"How to Add Custom CSS to Your WordPress Site: 6 Methods Explored"},"content":{"rendered":"<p>There\u2019s more than one way to add custom CSS to your WordPress site. You&#8217;ll see how in this article.<\/p>\n<p>In this post, I\u2019ll explain the strengths and weaknesses of 6 different methods so you can decide which suits you best, and let you get on with customizing your site.<\/p>\n<p>Continue reading, or jump ahead using these links:<\/p>\n<ul>\n<li><a href=\"#finding-the-design-elements\">Finding the Design Elements You Want to Customize<\/a><\/li>\n<li><a href=\"#wordpress-and-css\">How WordPress and CSS Work Together<\/a><\/li>\n<li><a href=\"#wordpress-customizer\">Method #1: Use the WordPress Customizer to Edit CSS<\/a><\/li>\n<li><a href=\"#edit-theme-css-files\">Method #2: Edit Your Theme\u2019s style.css File<\/a><\/li>\n<li><a href=\"#edit-child-theme-css-files\">Method #3: Use a Child Theme to Edit CSS<\/a><\/li>\n<li><a href=\"#fse\">Method #4: Edit a Full Site Editor Theme<\/a><\/li>\n<li><a href=\"#page-builder\">Method #5: Use a Page Builder to Edit CSS<\/a><\/li>\n<li><a href=\"#plugin\">Method #6: Use a Plugin to Edit CSS<\/a><\/li>\n<\/ul>\n<h2 id=\"finding-the-design-elements\">Finding the Design Elements You Want to Customize<\/h2>\n<p>Once you&#8217;ve isolated a part of your theme that you&#8217;d like to change (for example, the post title), you&#8217;ll need to determine the CSS properties applied to it so that you can make the appropriate changes. Fortunately, that process isn&#8217;t complicated.<\/p>\n<p>CSS uses selectors to determine which design declarations to apply to a specific part of your website. Usually, this is done by specifying a &#8220;class&#8221; for the specific element. However, CSS can also be used to define the layout for an entire element (for example, the &#8220;&lt;body&gt;&#8221; tag) or an element based on its ID.<\/p>\n<p>Fortunately, popular browsers allow you to see which selectors and which declarations are applied to an element on the page with just a few clicks. In Google Chrome, for example, you simply highlight a specific portion of the document and then right-click, as shown below.<\/p>\n<div  class=\"wpdui-pic-regular  \"> <img loading=\"lazy\" decoding=\"async\" class=\"attachment-735x735\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/08\/child-theme-800x309.png\" alt=\"child-theme\" width=\"735\" height=\"284\" \/> <\/div>\n<p>Select <strong>Inspect Element<\/strong> from the drop-down that appears and you&#8217;ll see the design information in the window on the right. You can see an example of that below.<\/p>\n<div  class=\"wpdui-pic-regular  \"> <img loading=\"lazy\" decoding=\"async\" class=\"attachment-735x735\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/08\/inspect-element1-800x363.png\" alt=\"inspect-element\" width=\"735\" height=\"334\" \/> <\/div>\n<p>Those items highlighted in red show you the specific design descriptors that apply to the text you had highlighted. For example, the &#8220;font-size&#8221; element tells you that the font displayed in that highlighted text is sized at 13 pixels (&#8220;13px&#8221;). The descriptors are surrounded in curly braces by the selectors. The name of the relevant style sheet file is displayed just to the right of the selectors.<\/p>\n<p>Once you&#8217;re armed with all of that information, modifying the design is easy. For example, if you want to change the font from 13px to 14px, you simply search your style sheet file, displayed just to the right for those selectors (&#8220;#plugin-info .block-content&#8221;) and change the &#8220;13px&#8221; to &#8220;14px.&#8221;<\/p>\n<p>You can do the same thing in Firefox, just highlight a specific portion of the page, right-click on it, and then select <em>Inspect Element<\/em> from the menu that appears.<\/p>\n<h2 id=\"wordpress-and-css\">How WordPress and CSS Work Together<\/h2>\n<p>It&#8217;s a given that no two WordPress themes are created equal. So, keep in mind that your WordPress theme might not comply 100% with what you read in the following sections.<\/p>\n<p>That said, it&#8217;s more than likely that the CSS used to present your WordPress site is located in a file called <em>style.css<\/em>. This is a common name for a stylesheet for any type of website, not just a WordPress website.<\/p>\n<p>If you look at that file, you&#8217;ll find that it includes comprehensive stylistic &#8216;instructions&#8217; for your theme. It&#8217;s beyond the scope of this tutorial to cover CSS syntax in complete detail, but if you want to delve deeper into it, we recommend you start with <a href=\"http:\/\/www.w3schools.com\/\" target=\"_blank\">W3Schools&#8217;<\/a>\u00a0course\u00a0<a href=\"http:\/\/www.w3schools.com\/css\/\" target=\"_blank\">here<\/a>.<\/p>\n<p>With that out of the way, let&#8217;s move on to the aforementioned methods for editing CSS!<\/p>\n<h2 id=\"wordpress-customizer\">Method #1 &#8211;\u00a0Use the WordPress Customizer to Edit CSS<\/h2>\n<p>The WordPress Customizer allows you to customize your website&#8217;s appearance, including adding CSS code.<\/p>\n<p>To do this, go to Appearance &gt; Customize in your WordPress dashboard, and then select the &#8220;Additional CSS&#8221; option.<\/p>\n<p>Here, you can add your CSS code and see a live preview of the changes as you make them.<\/p>\n<p>For example, to change the font color of your website&#8217;s body text to blue, you could add the following code to the &#8220;Additional CSS&#8221; section:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\r\nbody {\r\ncolor: blue;\r\n}\r\n\r\n<\/pre>\n<figure id=\"attachment_214877\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-214877 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2023\/02\/wordpress-customizer.png\" alt=\"WordPress Theme Customizer - Additional CSS\" width=\"769\" height=\"607\" \/><figcaption class=\"wp-caption-text\">Add your CSS code into the WordPress theme customizer&#8217;s Additional CSS field.<\/figcaption><\/figure>\n<h2 id=\"edit-theme-css-files\">Method #2 &#8211; Edit Your Theme&#8217;s CSS File<\/h2>\n<p>There are two ways to\u00a0access your theme&#8217;s <em>style.css<\/em> file.<\/p>\n<p>One way is to do so from your WordPress administration dashboard. On the left-hand navigation bar, highlight the <em>Appearance<\/em> option. A fly-out menu should display several more options. At the bottom of that menu, you&#8217;ll see the <strong>Theme File Editor<\/strong> option. Click on that.<\/p>\n<figure id=\"attachment_214928\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-214928\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/08\/appearance-theme-file-editor.png\" alt=\"Appearance - Theme File Editor menu\" width=\"762\" height=\"408\" \/><figcaption class=\"wp-caption-text\">Appearance &#8211; Theme File Editor menu<\/figcaption><\/figure>\n<p>Once you&#8217;re on the <em>Edit Themes<\/em> page, you&#8217;ll see a list of files on a vertical bar on the right-hand side of the page. Scroll down that list of files and select <em>style.css<\/em>.<\/p>\n<figure id=\"attachment_214889\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-214889 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2023\/03\/theme-css-file.png\" alt=\"WordPress Theme CSS file\" width=\"975\" height=\"410\" \/><figcaption class=\"wp-caption-text\">You can add your custom CSS to your WordPress Theme&#8217;s CSS file but it&#8217;s not recommended.<\/figcaption><\/figure>\n<p>You can use this screen to edit the file to make changes to your site&#8217;s design, but there&#8217;s a better way to do it (more on this in a moment).<\/p>\n<p>The other way to find the stylesheet is to browse through the operating system of your hosting provider and locate the file in the theme folder. The exact location will vary depending on your hosting provider.<\/p>\n<p>In the example shown below, the name of the website (in our case <em>thecare<\/em>) is a folder under the <em>public_html<\/em> folder. Since WordPress is installed for that site, you can see the <em>wp-content<\/em> folder under <em>thecare<\/em>.<\/p>\n<p>Underneath the <em>wp-content<\/em> folder is another folder called <em>themes<\/em>, which is where all of the WordPress themes are installed. Since that site uses a theme called <em>Newsletter<\/em>, the correct <em>style.css<\/em> is located in the <em>newsletter-parent<\/em> folder.<\/p>\n<div  class=\"wpdui-pic-regular  \"> <img loading=\"lazy\" decoding=\"async\" class=\"attachment-735x735\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/07\/Newsletter-parent-folder-800x401.png\" alt=\"Newsletter parent folder\" width=\"735\" height=\"368\" \/> <\/div>\n<p>At this point, you might be asking yourself: &#8220;Why is there a <em>newsletter-parent<\/em> and a <em>newsletter-child<\/em> folder?&#8221; That&#8217;s a very good question, and it&#8217;s about to be answered.<\/p>\n<h2 id=\"edit-child-theme-css-files\">Method #3 &#8211; Use a Child Theme to Edit CSS<\/h2>\n<p>If you&#8217;ve downloaded an awesome theme and want to make some changes to it, you should do so with a child theme, as opposed to editing the main (or parent) theme.<\/p>\n<p>Why? Because developers can often update themes for bug fixes and design changes.\u00a0If you make changes to the main theme and then install an update, you&#8217;re going to overwrite your hard work.<\/p>\n<p>On the other hand, if you use a child theme to make CSS changes, only the parent theme will be updated. All of your changes in the child theme will remain.<\/p>\n<p>Some\u00a0professional theme developers are aware of the importance of child themes and will include one for you. Then, you can just update that child theme as much as you want without worrying about parent theme updates overwriting your changes.<\/p>\n<p>If you have a theme\u00a0that doesn&#8217;t include a child theme, it&#8217;s easy to add one. You can find instructions to do that <a href=\"https:\/\/wpmudev.com\/blog\/how-to-create-wordpress-child-theme\/\" target=\"_blank\">in our comprehensive guide to creating a child theme<\/a>.<\/p>\n<p>Note: If you cannot find the Theme File Editor in the Appearances menu, use the option below.<\/p>\n<h2 id=\"fse\">Method #4 &#8211; Edit Full Site Editor Themes<\/h2>\n<p>Many newer WordPress themes are starting to take advantage of the <a href=\"https:\/\/wpmudev.com\/blog\/full-site-editing-wordpress\/\" target=\"_blank\" rel=\"noopener\">Full Site Editor (FSE)<\/a>.<\/p>\n<p>FSE lets you edit the layout and design of your entire website using the WordPress block editor (similar to editing a page or blog post) and is only available for selected themes.<\/p>\n<p>With FSE-enabled themes, you will not find the Theme File Editor in the Appearances menu or the Theme Customizer, so to edit CSS in these themes, you will need to bring up a &#8220;hidden&#8221; and more restricted version of the Customizer and add your CSS there.<\/p>\n<p>To do this, log into your WordPress admin, copy and paste the URL below into your web browser, and replace <code>example.com<\/code> with your own domain.<\/p>\n<p><code>https:\/\/example.com\/wp-admin\/customize.php<\/code><\/p>\n<p>Click on the &#8216;Additional CSS&#8217; tab and add your custom CSS here as explained earlier.<\/p>\n<figure id=\"attachment_214893\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-214893\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2023\/03\/full-site-editor-css.png\" alt=\"Full Site Editor Themes\" width=\"765\" height=\"583\" \/><figcaption class=\"wp-caption-text\">You have to access the hidden WordPress Customizer to add CSS to FSE themes.<\/figcaption><\/figure>\n<h2 id=\"page-builder\">Method #5 &#8211; Use Page Builders to Edit CSS<\/h2>\n<p>If you are using a page builder (e.g. Elementor), you can often add the code directly in the page at the item level.<\/p>\n<p>In Elementor, for example, go to Advanced &gt; Custom CSS. See this video below for more details:<\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><span class=\"embed-youtube-lazy-id dev-hidden\">xv9RjJky720<\/span><\/span><\/p>\n<p><em>Note:<\/em> This method works differently for different page builders. Check the documentation for your specific page builder&#8217;s for details.<\/p>\n<h2 id=\"plugin\">Method #6 &#8211; Use a Plugin to Edit CSS<\/h2>\n<p>The most convenient way of editing your site\u2019s CSS is arguably via a plugin.<\/p>\n<p>One of the main advantages\u00a0to using a plugin is similar to that of using a child theme. If you update the theme, your changes won&#8217;t be overridden because they&#8217;re stored separately from the theme&#8217;s files. The other advantage, of course, is that you won&#8217;t have to bother creating a child theme.<\/p>\n<p>There are several plugins available that allow you to add custom CSS to your WordPress website.<\/p>\n<p>Here are a few great plugins to use for modifying CSS:<\/p>\n<h3>Simple Custom CSS and JS<\/h3>\n<figure id=\"attachment_214880\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-full wp-image-214880\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2023\/03\/simple-custom-css-js-1050x471.png\" alt=\"Simple Custom CSS and JS plugin.\" width=\"1050\" height=\"471\" \/><figcaption class=\"wp-caption-text\">Use a plugin like Simple Custom CSS and JS to add CSS code to WordPress.<\/figcaption><\/figure>\n<p><a href=\"https:\/\/wordpress.org\/plugins\/custom-css-js\/\" rel=\"noopener\" target=\"_blank\">Simple Custom CSS and JS<\/a>\u00a0allows you to easily add custom CSS and JavaScript code to your website.<\/p>\n<p>For example, let&#8217;s say you want to change the background color of your website&#8217;s header to green.<\/p>\n<p>Simply install the &#8220;Simple Custom CSS and JS&#8221; plugin and navigate to the &#8220;Add Custom CSS&#8221; section:<\/p>\n<figure id=\"attachment_214882\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-full wp-image-214882\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2023\/03\/simple-custom-css-js-code-field-1050x572.png\" alt=\"Simple Custom CSS and JS plugin - add custom CSS field.\" width=\"1050\" height=\"572\" \/><figcaption class=\"wp-caption-text\">Add your custom CSS to WordPress using Simple Custom CSS and JS plugin&#8230;easy!<\/figcaption><\/figure>\n<p>Add the following code and hit the Publish button to implement your new style change:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\r\n.header {\r\nbackground-color: green;\r\n}\r\n\r\n<\/pre>\n<h3 class=\"wpdui-tutorial-list__item__title\">Simple Custom CSS<\/h3>\n<figure id=\"attachment_206774\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-206774\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/08\/simple-custom-css-1.png\" alt=\"Simple Custom CSS logo.\" width=\"600\" height=\"112\" \/><figcaption class=\"wp-caption-text\">Simple Custom CSS is an extremely popular option.<\/figcaption><\/figure>\n<p><a href=\"https:\/\/wordpress.org\/plugins\/simple-custom-css\/\" rel=\"noopener\" target=\"_blank\">Simple Custom CSS<\/a>\u00a0is one of the most popular options.\u00a0It\u2019s been installed more than 100,000 times and has received a five-star rating.<\/p>\n<h3 class=\"wpdui-tutorial-list__item__title\">Child Theme Configurator<\/h3>\n<figure id=\"attachment_206775\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-206775\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/08\/child-theme-configurator.png\" alt=\"Child theme configurator header.\" width=\"600\" height=\"189\" \/><figcaption class=\"wp-caption-text\">A fast and easy-to-use option.<\/figcaption><\/figure>\n<p>Last, but certainly not least, is\u00a0<a href=\"https:\/\/wordpress.org\/plugins\/child-theme-configurator\/\" rel=\"noopener\" target=\"_blank\">Child Theme Configurator<\/a>. This is a solution\u00a0that enables you to customize the layout of your website with a child theme.<\/p>\n<p>The plugin\u00a0also optimizes your design strategy. If you\u2019ve worked with CSS\u00a0for any length of time, you know that sometimes the overall structure of your stylesheets can get cumbersome. Child Theme Configurator assists you in that it properly allocates your stylesheets so for optimal performance.<\/p>\n<p>Child Theme Configurator has been downloaded more than 40,000 times and enjoys a 4.8 star rating.<\/p>\n<p>The bottom line is this: Whatever functionality you&#8217;re trying to create, it&#8217;s probably already been created by someone else who&#8217;s willing to provide it to you, either free of charge or for a reasonable\u00a0fee. It might be best to save some time and just go with a solution that&#8217;s already been produced for you.<\/p>\n<p>For more plugins, check out these <a href=\"https:\/\/wpmudev.com\/blog\/live-editing-css\/\" target=\"_blank\" rel=\"noopener\">free CSS plugins for live editing your WordPress site<\/a>.<\/p>\n<h2>Wrapping Up<\/h2>\n<p>If you&#8217;re comfortable with coding, create a child theme and dig into style.css. But if you prefer to leave those well alone, however, there are plenty of plugins available, and chances are they&#8217;ll cater to your needs reasonably well.<\/p>\n<p>It&#8217;s a great idea to begin to get to grips with CSS if you&#8217;re looking to develop your site further, and there are plenty of <a href=\"https:\/\/www.linkedin.com\/learning\/topics\/css\" target=\"_blank\">courses<\/a> and <a href=\"http:\/\/www.csstutorial.net\/\" target=\"_blank\">tutorials<\/a> out there to help you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There\u2019s more than one way to add custom CSS to your WordPress site. In this Weekend WordPress we explore the strengths and weaknesses of three different methods so you can decide which suits you best, and let you get on with customizing your site.<\/p>\n","protected":false},"author":37930,"featured_media":199255,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[1044,684,10188,9798],"tutorials_categories":[],"class_list":["post-143606","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-css","tag-child-themes","tag-simple-custom-css","tag-weekend-wordpress-projects"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/143606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/37930"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=143606"}],"version-history":[{"count":28,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/143606\/revisions"}],"predecessor-version":[{"id":214927,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/143606\/revisions\/214927"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/199255"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=143606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=143606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=143606"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=143606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}