Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Part 2.3Why CSS is used

CSS is one a few ways used to style blank HTML or XML.

It receives so many updates year upon year that new features are generally quite small on the grand scale of things. This means that websites can have new instructions that are passed to the browser to make the site appear fancy.

But why use CSS?

Going back a bit

Prior to CSS, sites were styled (and can still be styled) as follows:

HTML
Hello there
<font color="#f00">
	This is red text
</font>
                      			
Hello there This is red text

Now what happens when a piece of text needs to be in the same paragraph as the red text, but also wants to add bold to it? It then needs nested again - a <font> element within one another.

This will get messier the more fonts there are.

CSS

CSS solves this problem completely and also makes it easier to write and maintain.

If the site has a site wide theme, like this one does, CSS brings the benefit of 'one change does it all' to the site. It also allows the styling information to be cached, resulting in smaller files to be transported from the web server hosting. Such an example is when this website is first loaded, it take a little longer than when another page on the site is loaded after.

Further to this, it also follows the content, design and functionality pattern better than if there is one document containing absolutely everything. This is good for the developer when it comes to organisation.

This is why CSS is used.

Feedback 👍
Comments are sent via email to me.