Introduction to CSS

What is CSS? CSS stands for “Cascading Style Sheets”.

The CSS helps in giving our HTML some special effects which naturally shouldn’t have been possible with just ordinary HTML tags. In other words, they help in controlling the look and feel of our HTML documents in a more organized and efficient way.

Basic HTML Tag Example

One basic fact is that HTML was never intended to contain tags for formatting a document; but was rather intended to define the content of a document, like:

<h1 >This is a heading</h1>
<center> This is a center align</center>

Tags like <font>, color attributes, etc, when added to HTML 3.2, constituted a deep problem to web developers. Based on this, the World Wide Web Consortium (W3C) created they called the CSS. This CSS was then added to HTML 4.0 to the outstanding problem of formatting as they could be removed and stored in a separate CSS file.

What Does CSS do?

Now with CSS, you can completely restyle your website by just giving formatting or reformatting your CSS codes, apart from that, you can equally use the style you have created on any website as all browsers today support CSS. Above all, CSS codes are used in adding new looks to your HTML.

Cascading Style Sheets is a style sheet language used to add styles to the HyperText Markup Language (HTML) document. This implies that it is used for rendering the presentation of web pages. You can use it as Inline Cascading Style Sheets, Internal Cascading Style Sheets, or External Cascading Style Sheets.

The default Cascading Style Sheets tag is:


This is what you normally use for rendering or defining Internal Cascading Style Sheets.

Advantages of CSS

CSS saves time

The CSS allows you to write the code once and use it many times as per your requirement. That means you can define a style for every element in HTML and apply it to multiple websites as you like.

Maintenance Easy

For Global change, you can easily change the style and all elements will update automatically on all web pages.

Global Web Standards

The HTML attributes might not be up to the mark and the CSS was recommended. So using the CSS with HTML makes compatible with future browsers.

Page Loads Faster

While writing CSS, you no need to specify HTML tag attributes each and every time. you can just specify CSS rule once and apply to that tag as many times it occurs. It downloads fast because of less code.

Multiple Device Compatibility

The Style sheet makes the content should be enhanced for more than one type of device. With the same HTML document, you can present various versions of the website on multiple devices like cell phones, PDAs, and for printing.

Superior Styles of HTML

The CSS has more attributes than HTML, It helps to provide a better look to your HTML page comparison to HTML attributes.

CSS Versions

In December 1996, CSS 1 was released from W3C as a recommendation and it specifies the CSS language as a simple visual formatting model for all HTML tags.

Whereas CSS2 was released in May 1998 from W3C as a recommendation and builds on CSS1. It provides media style sheets like printers, downloadable fonts, tables, aural devices and element positioning.