How To Manually Minify CSS Codes In Static Websites

minify css code

Minify CSS Code

Webmasters minify CSS codes to reduce their size so that they load faster. Online business success depends on many factors. One of them is your website speed. Most online marketers focus more on design, content and SEO. They forget the technical aspect of improving the load times to give the internet users a pleasant experience.

This simple tutorial is intended to help webmasters to learn how they can manually minify CSS codes in static websites. It’s designed to help web designers to create sites with downsized CCS markups. A minified CSS source code leads to improvement in the website load time performance, hence an excellent experience for internet users. It also leads to a better search engine ranking.

What Does It Mean to Minify CSS Codes?

People use the term minification in computer programming languages. To minify CSS codes is to remove all unnecessary characters from the source code without altering its functionality or the way it works. These unnecessary characters include the following:

  • Whitespace characters – these represent horizontal and vertical space in the typography.
  • The new line – special characters that indicate the end of a line of text.
  • Comments – these are source code comments that make it easier to understand the code
  • Blocks – statement blocks usually signified by the use of brace brackets { }.

To minify CSS codes is to reduce them, to shorten them, to downsize them, to trim them, to compress them or compact them. A minified CSS code and the one that is not minified both display your website layout in the same way. The only difference is that with minified CSS source codes, a few bytes of CSS markup is sent and the number of requests to get the bits is reduced. The reverse is true with CSS codes that aren’t minified. More CSS bytes are sent, leading to an increased number of requests.

How Do You Minify CSS Source Codes?

There are several minify CSS tools that you can use to compress your CSS, such as CSS Compressor. But in this tutorial, I would like to show you how you can manually do it. To effectively minify your CSS markup, do the following:

First, Remove all the CSS Source Code Comments.

Programmers use these comments to make the source code easier to understand in programming. But they has nothing to do with They look like in the examples below:

/* tells browsers that don’t read HTML 5 tags to render like divs */

/* Copyright (c) 2012 Goleza Designers Limited, All rights reserved

/* Reset v1.0 | 20080212 –

Secondly, Remove Whitespace Characters in the Source Code.

Examples of white space are as follows:

U+0020 | SPACE (HTML:  )
ASCII space ( )
ASCII tab ( )
Zero-width space (​)


Thirdly, Format your CSS Codes on a Single Line.

Your CSS blocks should look like as in Block A and NOT as in Block B

Block A

h3 {color:#FF8000;font-family: Verdana,Arial, “Times New Roman”;text-align:center;text-height:1em;}


Block B

h3 {
font-family: Verdana,Arial, “Times New Roman”;

Lastly, Remove Newlines.

These are characters that signify the end of the text line, also known as line endings, line breaks.

A well minified source code should therefore look like as in the example below:

#mainLeft img{border:none;position:absolute;top:250px;z-index:5;}
#mainLeft .hostgator{border:none;position:absolute;top:670px;left:102px;z-index:5;}
#mainLeft h2{color:#444;font-size:0.8em;text-transform:uppercase;text-align:center;}
#mainLeft h1 span{font-size:40px;color:#FF8000;font-weight:bold;}
#mainLeft h2 span{top:493px !important;}

In conclusion, when you minify CSS code using the steps mentioned above, you will reduce the network latency, enhance compression and improve browser loading time and execution. A fast-loading website is key to your online business success.

  • Bundling and minifying in ASP.NET MVC

Contact Us

Equatorial Shopping Mall, Suite 607

Plot 37/39, William Street, Kampala

Call: +256 – 703 – 779 889

WhatsApp: +256 – 772 – 327373


Goleza Shop

Recent Articles

Browse by Tags

You May Also Like


Submit a Comment

Your email address will not be published.

Thank You For Visiting Us

Goleza Logo

Join Our Newsletter

Subscribe to our mailing list to receive the latest news and updates.

You have Successfully Subscribed!

Share This