{"id":11107,"date":"2022-09-21T09:59:09","date_gmt":"2022-09-21T09:59:09","guid":{"rendered":"https:\/\/www.icdsoft.com\/blog\/?p=11107"},"modified":"2026-03-19T08:15:12","modified_gmt":"2026-03-19T08:15:12","slug":"css-explained","status":"publish","type":"post","link":"https:\/\/www.icdsoft.com\/blog\/css-explained\/","title":{"rendered":"What is CSS &#8211; Cascading Stylesheets Explained"},"content":{"rendered":"\n<p>When you open a website, you may or may not like its design, but you probably don\u2019t think about what stands behind that design. Adding text and images is easy; the more difficult part is to know where exactly they will be positioned and how exactly they will look. Many websites are built using PHP and\/or HTML, but these languages do not provide any means to format the style of the content. HTML is designed only to describe the content of a page, but not its look. This is where CSS, or Cascading Style Sheets, comes into place.<\/p>\n\n\n\n<ul class=\"wp-block-advgb-summary advgb-toc alignnone\"><li class=\"toc-level-1\"><a href=\"#what-is-css-ebaccf78-703f-455b-885f-dc917f77dc13\">What is CSS<\/a><\/li><li class=\"toc-level-1\"><a href=\"#short-history-b498dc14-7aea-4747-95bc-a0fc3e910fc8\">Short history<\/a><\/li><li class=\"toc-level-1\"><a href=\"#types-of-css-9c9be4e8-8609-4069-b083-778349130e0e\">Types of CSS<\/a><\/li><li class=\"toc-level-1\"><a href=\"#advantages-of-using-css-340602a8-fd12-452a-8de9-29e3c284ff2f\">Advantages of using CSS<\/a><\/li><li class=\"toc-level-1\"><a href=\"#syntax-97bda7c0-99bb-4261-935e-64062e5e0bf3\">Syntax<\/a><\/li><li class=\"toc-level-1\"><a href=\"#minify-css-4bffffe5-3e99-419a-8d48-bfbf460fe4b2\">Minify CSS<\/a><\/li><li class=\"toc-level-1\"><a href=\"#adding-custom-css-code-c6a35fa9-4953-4444-8875-c2bd564e8e36\">Adding custom CSS code<\/a><\/li><li class=\"toc-level-1\"><a href=\"#wrap-up-10ad8bdc-3f1d-4a0a-832d-ab354afcc468\">Wrap Up<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-css-ebaccf78-703f-455b-885f-dc917f77dc13\"><strong>What is CSS<\/strong><\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-large is-resized\"><img decoding=\"async\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css1-726x1024.png\" alt=\"CSS3 logo in blue and white shield design representing Cascading Style Sheets technology.\" class=\"wp-image-11111 lazyload\" width=\"147\" height=\"208\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css1-726x1024.png 726w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css1-213x300.png 213w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css1.png 800w\" data-sizes=\"(max-width: 147px) 100vw, 147px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 147px; --smush-placeholder-aspect-ratio: 147\/208;\" \/><\/figure>\n<\/div>\n\n\n<p>CSS is a rule-based language that is used to specify the style of certain elements on a given web page. Rule-based means that the website owner creates groups of rules that are applied to these elements. In other words, CSS is a design language that is used to manage the way a website looks. It can be used for simple tasks such as specifying the font size, but as you will see below, it includes some advanced functionalities as well.<\/p>\n\n\n\n<p>CSS allows website creators to separate content from presentation, making it possible to edit either one separately. This is something important as it allows both site owners and web developers to focus on one or the other, which facilitates their work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"short-history-b498dc14-7aea-4747-95bc-a0fc3e910fc8\">Short history<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css2-1.jpg\" alt=\"Man smiling wearing glasses and a black t-shirt with browse me text, standing against a light blue background.\" class=\"wp-image-11113 lazyload\" width=\"210\" height=\"234\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css2-1.jpg 800w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css2-1-269x300.jpg 269w\" data-sizes=\"(max-width: 210px) 100vw, 210px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 210px; --smush-placeholder-aspect-ratio: 210\/234;\" \/><figcaption>H\u00e5kon Wium Lie, 2009. Source: Wikipedia<\/figcaption><\/figure>\n<\/div>\n\n\n<p>CSS was created in 1994 by H\u00e5kon Wium Lie, a web standards activist. Back then, he worked at CERN with Tim Berners-Lee, the creator of the World Wide Web, so he had good insight into HTML and the first websites. In 1995, he joined W3C (World Wide Web Consortium), the international standards organization for the Web, which was created by Berners-Lee. There, he worked with Bert Bos, a computer scientist, who created the Argo web browser as a test application for CSS. Together, they created the CSS1 (1996), CSS2 (1998) and CSS3 (1999) specifications.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#3373dc\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"5e5432\"><div class=\"gb-notice-text\" style=\"border-color:#3373dc\"><p>The work of H\u00e5kon Wium Lie as a web standards activist has led to a number of significant changes in the World Wide Web. He campaigned for browsers to support downloadable web fonts, for easier video publishing (essentially proposing the &lt;video> HTML tag for websites), and for printing directly from the Web, instead of copying content to a text\/image editor first. <\/p><\/div><\/div>\n\n\n\n<p><strong>CSS1<\/strong> allowed web developers to specify font properties, background color, text alignment, padding and basic positioning of different elements.<\/p>\n\n\n\n<p><strong>CSS2<\/strong> expanded the above functionalities by adding relative, absolute and fixed positioning, and media types \u2013 different styles for screens, printers, etc.<\/p>\n\n\n\n<p><strong>CSS3<\/strong>, with some minor revisions, is the current specification. Unlike the previous versions, CSS3 does not include a single set of features. Instead, it is divided into different modules, each one including various features. CSS3 includes things such as transitions, shadows, embedded fonts, rounded corners, and responsive design. As some modules are changed independently, some people refer to the latest updates of CSS3 as CSS4.<\/p>\n\n\n\n<p><strong>Grid<\/strong> and <strong>Flexbox<\/strong> are two modules that have significantly gained in popularity lately as they allow responsive web pages to be created without using floats and positioning. The modules are an example of the robust features you can have with CSS. The Grid Layout Module allows you to create a grid of rows and columns, which are suitable for large-scale layouts, while the Flexible Box Module allows you to add flex containers, which makes it better for small-scale layouts. The two modules can be used together. All modern browsers support them, both on desktop and mobile devices.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"841\" height=\"363\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css3.png\" alt=\"Comparison of CSS Flexbox as one-dimensional layout versus CSS Grid as two-dimensional layout with directional arrows.\" class=\"wp-image-11114 lazyload\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css3.png 841w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css3-300x129.png 300w\" data-sizes=\"(max-width: 841px) 100vw, 841px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 841px; --smush-placeholder-aspect-ratio: 841\/363;\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"types-of-css-9c9be4e8-8609-4069-b083-778349130e0e\">Types of CSS<\/h2>\n\n\n\n<p>There are different ways to add CSS code to your website. You will come across all of them, but some are way more common than others (and for a reason):<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>External<\/strong> \u2013 All the CSS code is placed in a single .css file in the website root directory or a subdirectory. The site files load the required CSS code as needed from that file. This is the best option if you want to optimize your code as the site core files will not include any design customizations, but only functional code. Using a single file also makes it very easy to apply updates to the design across the entire site with minimal code changes.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Internal<\/strong> \u2013 The CSS code is added to the header of each file. This option is not very common, but it can be used for websites that are not updated often in terms of their design. The advantage here is that the CSS code can be updated safely on a given page without affecting the rest of the site pages. Even if something goes wrong on that page, the other pages will remain intact.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Inline<\/strong> \u2013 CSS code snippets are added directly in the code wherever they are needed. This way, CSS code is added for each particular element of the site. Here is an example of a heading with inline CSS code: &lt;h2 style=\u201dfont-size:20px;color:red;\u201d&gt;This is a headline.&lt;\/h2&gt;. This is a very unpopular approach nowadays as adding inline code is very time-consuming. Updating such code will be very difficult as you will have to go through the entire code of the site to make changes. This is why using inline code is very impractical if you have more than a few pages.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex advgb-dyn-0bd9ffd1\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css4.png\"><img decoding=\"async\" width=\"1024\" height=\"347\" data-id=\"11115\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css4-1024x347.png\" alt=\"HTML code example using internal CSS styling with maroon heading and linen background\" class=\"wp-image-11115 lazyload\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css4-1024x347.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css4-300x102.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css4-1536x521.png 1536w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css4.png 1732w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/347;\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css5.png\"><img decoding=\"async\" width=\"1024\" height=\"296\" data-id=\"11116\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css5-1024x296.png\" alt=\"HTML code with a blue centered heading and red paragraph using inline CSS; displayed in browser.\" class=\"wp-image-11116 lazyload\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css5-1024x296.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css5-300x87.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css5-1536x444.png 1536w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css5.png 1733w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/296;\" \/><\/a><\/figure>\n<figcaption class=\"blocks-gallery-caption\">An example of internal and inline CSS.<\/figcaption><\/figure>\n\n\n\n<p>It is important to know that if you use more than one approach, the inline CSS code will have the highest priority, then comes the internal\/external code, and finally, the browser default style.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"advantages-of-using-css-340602a8-fd12-452a-8de9-29e3c284ff2f\">Advantages of using CSS<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Saves work<\/strong>. You can create and maintain less code to style your website. Less code means less chance of errors.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Saves time.<\/strong> If you use the same elements across the site, it will be very easy to update their style. You will save a lot of time updating a single value compared to updating the same code on multiple pages.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Preserves consistency<\/strong>. If used well, a single stylesheet can be used to style all the elements on a website. This way, if you add a button on multiple pages, for example, it will look the same on all of them.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Saves bandwidth.<\/strong> Browsers usually cache external stylesheets, so they don\u2019t have to reload the code over and over again when users browse different pages. CSS files are relatively small, but the more visitors you have, the more bandwidth you will save.<\/li><\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-large is-resized\"><img decoding=\"async\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css6-1024x667.png\" alt=\"Responsive web design illustration showing desktop, laptop, tablet, and smartphone layouts with colored sections.\" class=\"wp-image-11119 lazyload\" width=\"316\" height=\"205\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css6-1024x667.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css6-300x195.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css6.png 1280w\" data-sizes=\"(max-width: 316px) 100vw, 316px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 316px; --smush-placeholder-aspect-ratio: 316\/205;\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\"><li><strong>Supports different devices<\/strong>. This is something quite important as CSS allows you to have different styles for different devices (desktop, mobile, print). This way, you can provide a version of your pages that is not only responsive but is also accessible i.e. any unneeded advertisements and navigation elements can be hidden to make it easier for screen readers to go through the page content.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"syntax-97bda7c0-99bb-4261-935e-64062e5e0bf3\">Syntax<\/h2>\n\n\n\n<p>Here we will show you only the very basic CSS syntax along with a few examples. We cannot add a full tutorial in a blog article as there are multiple modules with lots and lots of functionalities, but if you are interested, you can check out resources like <a href=\"https:\/\/www.w3schools.com\/css\/default.asp\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.w3schools.com\/css\/default.asp<\/a> or <a href=\"https:\/\/www.quackit.com\/css\/examples\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.quackit.com\/css\/examples\/<\/a>. There, you can even write and test your CSS code.<\/p>\n\n\n\n<p>As we mentioned, CSS is a rule-based language. A rule consists of two parts \u2013 a selector and a declaration block. The selector is the HTML element you want to style. The declaration block includes a CSS property name and a corresponding value, separated by a colon.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img decoding=\"async\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css7-1.png\" alt=\"Diagram explaining CSS rule structure with selector, properties, values, and declaration for styling text.\" class=\"wp-image-11123 lazyload\" width=\"445\" height=\"159\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css7-1.png 805w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css7-1-300x107.png 300w\" data-sizes=\"(max-width: 445px) 100vw, 445px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 445px; --smush-placeholder-aspect-ratio: 445\/159;\" \/><\/figure>\n<\/div>\n\n\n<p>You can add multiple declarations in a single block. You only have to separate them with semicolons and surround the whole block with curly brackets.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>h2 { \n\ncolor: red; \n\nfont-size: 10px; \n\n}<\/code><\/pre>\n\n\n\n<p>If this sounds complicated, here is an example that will show you how easy CSS actually is:<\/p>\n\n\n\n<p>In this example, all \u201ch2\u201d elements will be red and will have a font size of 10px. Here is another example where all \u201cp\u201d elements will be blue and will be aligned to the left:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>p { \n\n  color: blue; \n\n  text-align: left; \n\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex advgb-dyn-b8310e36\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css8.png\"><img decoding=\"async\" width=\"1024\" height=\"362\" data-id=\"11121\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css8-1024x362.png\" alt=\"HTML and CSS code example showing blue text for styled paragraphs aligned to the left.\" class=\"wp-image-11121 lazyload\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css8-1024x362.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css8-300x106.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css8.png 1273w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/362;\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css9.png\"><img decoding=\"async\" width=\"1024\" height=\"365\" data-id=\"11122\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css9-1024x365.png\" alt=\"HTML and CSS code styling an h2 element in red with 10px font size, displayed in browser.\" class=\"wp-image-11122 lazyload\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css9-1024x365.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css9-300x107.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css9.png 1287w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/365;\" \/><\/a><\/figure>\n<\/figure>\n\n\n\n<p>Here are a few more examples that can show you some of the things you can do with CSS. Add a background image for a textbox:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{ \n\nbackground-image: url('\/images\/background.png'); \n\nwidth: 20px; \n\npadding: 30px; \n\nborder: solid;\t\t \n\n}<\/code><\/pre>\n\n\n\n<p>Add a rule only for specific screen sizes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@media only screen and (min-width: 768px)<\/code><\/pre>\n\n\n\n<p>Add a hover effect to a button:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>button { \n\n  color: #016898; \n\n} \n\nbutton:hover { \n\n  color: #19B5FE; \n\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"minify-css-4bffffe5-3e99-419a-8d48-bfbf460fe4b2\">Minify CSS<\/h2>\n\n\n\n<p>CSS code is often <strong>minified<\/strong>. The minification involves removing comments, spaces, and new lines, as they are not required for CSS code to work. Formatting is used to make the code human-readable as it is easier to write, debug and maintain, but web browsers and applications simply do not need such formatting.<\/p>\n\n\n\n<p>There are two reasons to minify the code. The first one is that the CSS file size can be reduced significantly, which can speed up your site a bit as the browser will execute a smaller file. Simple sites use less CSS code, but larger ones can have a more extensive CSS file, and the problem comes from the fact that browsers pause HTML parsing while they load all external CSS links. The second reason is that minified code is harder to read and copy, and this is a way for some web developers to \u201cobfuscate\u201d that code as an attempt to make it harder for a third party to copy it.<\/p>\n\n\n\n<p>Some web applications minify the CSS code by default. For others, you will have to use a plugin\/extension. If needed, you can use a free online tool as well, such as <a href=\"https:\/\/www.toptal.com\/developers\/cssminifier\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.toptal.com\/developers\/cssminifier<\/a> or <a href=\"https:\/\/www.cleancss.com\/css-minify\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.cleancss.com\/css-minify\/<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex advgb-dyn-33901682\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"555\" data-id=\"11125\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css10-1024x555.png\" alt=\"Screenshot of CSS code for WordPress Gutenberg page alignment and relevant GitHub issues links.\" class=\"wp-image-11125 lazyload\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css10-1024x555.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css10-300x163.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css10.png 1229w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/555;\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"580\" data-id=\"11126\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css11-1024x580.png\" alt=\"Minified CSS code example displaying styles for body, links, and block elements.\" class=\"wp-image-11126 lazyload\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css11-1024x580.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css11-300x170.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css11.png 1227w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/580;\" \/><\/figure>\n<figcaption class=\"blocks-gallery-caption\">You can clearly see the difference between human-readable and minified CSS code.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"adding-custom-css-code-c6a35fa9-4953-4444-8875-c2bd564e8e36\">Adding custom CSS code<\/h2>\n\n\n\n<p>If you are building a website from scratch and you are writing the code manually, you don\u2019t need a tutorial on how to add CSS code as you know what you are doing. If you don't have much experience and you use a template for an online site builder or a content management system, however, you can still edit the template CSS code or add custom code. To do that, you should find the style.css file of the theme, or you should look for an option to add the custom code using your dashboard. As you will see, it is easier to edit\/add code with some applications than with others. Here are a few tips on how to add\/edit CSS code with some popular applications.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css12.png\" alt=\"Custom CSS editor screen with a code snippet for a green button style including background color and text properties.\" class=\"wp-image-11128 lazyload\" width=\"350\" height=\"139\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css12.png 950w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css12-300x119.png 300w\" data-sizes=\"(max-width: 350px) 100vw, 350px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 350px; --smush-placeholder-aspect-ratio: 350\/139;\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\"><li><strong>ICDSoft Website Builder<\/strong>. To make sure that changes are not lost when the application is updated, add your custom code only through the dashboard. Once you log in, go to Design -&gt; More Settings -&gt; Custom code. Just make sure that you add the code between tags.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>WordPress<\/strong>. There are different ways to add or edit CSS code in WordPress. You will find the entire stylesheet of the theme you use in the site directory -&gt; \/wp-content\/themes\/theme-name\/style.css . If you want to edit this file directly, we recommend that you back it up before that.<\/li><\/ul>\n\n\n\n<div style=\"color:#32373c;background-color:#3373dc\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"5e5432\"><div class=\"gb-notice-text\" style=\"border-color:#3373dc\"><p>If anything goes wrong when you make changes, we have your back. We keep daily backups of all your content for 7 days for shared plans, and for 15 days for VPS plans, but our Extended Backups upgrade will give you access to regular backups for a whole year. You can also use our WordPress Toolkit to create on-demand backups of your WordPress websites.<\/p><\/div><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><a href=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css13.png\"><img decoding=\"async\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css13.png\" alt=\"WordPress CSS editor interface showing button styling code with accessibility tips.\" class=\"wp-image-11129 lazyload\" width=\"145\" height=\"351\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css13.png 372w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css13-124x300.png 124w\" data-sizes=\"(max-width: 145px) 100vw, 145px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 145px; --smush-placeholder-aspect-ratio: 145\/351;\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Some themes come with a dedicated section where you can edit many more theme-specific options compared to the default settings that WordPress allows you to edit. Almost all such themes include the option to add custom CSS code in that section. The code you add will have priority over the theme default CSS code for the elements you want to edit.<\/p>\n\n\n\n<p>Alternatively, you can use a plugin that will allow you to add code easily. A few examples of such plugins are <a href=\"https:\/\/wordpress.org\/plugins\/custom-css-js\/\" target=\"_blank\" rel=\"noreferrer noopener\">Simple Custom CSS and JS<\/a>, <a href=\"https:\/\/wordpress.org\/plugins\/so-css\/\" target=\"_blank\" rel=\"noreferrer noopener\">SiteOrigin CSS<\/a>, and <a href=\"https:\/\/wordpress.org\/plugins\/simple-custom-css\/\" target=\"_blank\" rel=\"noreferrer noopener\">Simple Custom CSS Plugin<\/a>. To minify CSS code, you can use <a href=\"https:\/\/wordpress.org\/plugins\/hummingbird-performance\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hummingbird<\/a>, <a href=\"https:\/\/wordpress.org\/plugins\/autoptimize\/\" target=\"_blank\" rel=\"noreferrer noopener\">Autoptimize<\/a>, or <a href=\"https:\/\/wordpress.org\/plugins\/wp-optimize\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP-Optimize<\/a>.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Joomla<\/strong>. Once you log in to the dashboard, go to <em>System -&gt; Site Templates -&gt; Details &amp; Files -&gt;<\/em> click on New File on top and select the CSS folder in the left pane that you will see. Name the new file user.css and type\/paste your CSS code. If the template you use doesn\u2019t have such an option, you can use an extension like <a href=\"https:\/\/extensions.joomla.org\/extension\/custom-css\/\" target=\"_blank\" rel=\"noreferrer noopener\">Custom CSS<\/a>, <a href=\"https:\/\/extensions.joomla.org\/extension\/head-css-script\/\" target=\"_blank\" rel=\"noreferrer noopener\">Head CSS Script<\/a>, or <a href=\"https:\/\/extensions.joomla.org\/extension\/xtypo\/\" target=\"_blank\" rel=\"noreferrer noopener\">XTypo<\/a>.<\/li><\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css14.png\"><img decoding=\"async\" data-src=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css14-1024x805.png\" alt=\"Joomla Cassiopeia template editor showing user.css file customization with CSS code for button styling.\" class=\"wp-image-11132 lazyload\" width=\"556\" height=\"436\" data-srcset=\"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css14-1024x805.png 1024w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css14-300x236.png 300w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css14-87x67.png 87w, https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/css14.png 1034w\" data-sizes=\"(max-width: 556px) 100vw, 556px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 556px; --smush-placeholder-aspect-ratio: 556\/436;\" \/><\/a><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\"><li><strong>Prestashop<\/strong>. The best option is to use a module such as <a href=\"https:\/\/classydevs.com\/free-modules\/classy-custom-css-js-module\/\" target=\"_blank\" rel=\"noreferrer noopener\">ClassyDevs Custom CSS &amp; JS<\/a>. Adding CSS code manually requires more advanced knowledge as you will have to edit core theme files apart from creating a custom .css file. If you have the skills to make the necessary changes without a module, you probably don\u2019t need a tutorial.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Opencart<\/strong>. Similar to other applications, you can edit the stylesheet directly if you go to \/ catalog\/view\/theme\/your_theme\/stylesheet\/stylesheet.css, or you can use an extension such as \u201c<a href=\"https:\/\/www.opencart.com\/index.php?route=marketplace\/extension\/info&amp;extension_id=36586&amp;filter_member=DPEXTENSION\" target=\"_blank\" rel=\"noreferrer noopener\">Custom JavaScript and CSS<\/a>\u201d. Make sure that you clear the application cache after you edit the code, otherwise the changes will not be applied.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Drupal<\/strong>. You can edit the CSS files of the theme you use if you go to the site root directory -&gt; \/sites\/theme-name\/files\/CSS. You should have good knowledge of CSS though, as the code is minified and it is hard to edit it. If you prefer a more user-friendly option, you can install a module such as <a href=\"https:\/\/www.drupal.org\/project\/extra_css_js\" target=\"_blank\" rel=\"noreferrer noopener\">Extra CSS and JS<\/a> (adds inline CSS), <a href=\"https:\/\/www.drupal.org\/project\/live_css\" target=\"_blank\" rel=\"noreferrer noopener\">Live CSS<\/a>, or <a href=\"https:\/\/www.drupal.org\/project\/css_editor\" target=\"_blank\" rel=\"noreferrer noopener\">CSS Editor<\/a>.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"wrap-up-10ad8bdc-3f1d-4a0a-832d-ab354afcc468\">Wrap Up<\/h2>\n\n\n\n<p>Using Cascading Style Sheets is mandatory for any website these days. Of course, a website can run without CSS, but it will surely not look pretty at all. Content is important, but the style can help a lot to create a great user experience. This is why, you should not neglect the style of the site elements, especially if there is an easy fix in the CSS code for some issue you have noticed or an easy way to customize some element.<\/p>\n\n\n\n<p>Apart from making a website look good, using CSS has several advantages. It can save you a lot of time when you build your site or update its style, it can make the site look good on different devices, and it can even save you and your visitors some bandwidth. Don\u2019t forget to minify the code for even better results if such an option is available.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You have probably heard about CSS. What exactly is CSS, though? Do you need it on your website and how can you add it? We will answer these questions in our article.<\/p>\n","protected":false},"author":1,"featured_media":11109,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-11107","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-general"},"author_meta":{"display_name":"ICDSoft","author_link":"https:\/\/www.icdsoft.com\/blog\/author\/icdsoft\/"},"featured_img":"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/csstitle-300x199.jpg","featured_image_src":"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/csstitle-scaled.jpg","featured_image_src_square":"https:\/\/www.icdsoft.com\/blog\/wp-content\/uploads\/2022\/09\/csstitle-scaled.jpg","author_info":{"display_name":"ICDSoft","author_link":"https:\/\/www.icdsoft.com\/blog\/author\/icdsoft\/"},"coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/www.icdsoft.com\/blog\/category\/general\/\" class=\"advgb-post-tax-term\">General<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">General<\/span>"]}},"comment_count":"0","relative_dates":{"created":"Posted 4 years ago","modified":"Updated 6 months ago"},"absolute_dates":{"created":"Posted on September 21, 2022","modified":"Updated on March 19, 2026"},"absolute_dates_time":{"created":"Posted on September 21, 2022 9:59 am","modified":"Updated on March 19, 2026 8:15 am"},"featured_img_caption":"","series_order":"","_links":{"self":[{"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/posts\/11107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/comments?post=11107"}],"version-history":[{"count":18,"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/posts\/11107\/revisions"}],"predecessor-version":[{"id":14975,"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/posts\/11107\/revisions\/14975"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/media\/11109"}],"wp:attachment":[{"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/media?parent=11107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/categories?post=11107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icdsoft.com\/blog\/wp-json\/wp\/v2\/tags?post=11107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}