What is CSS or Cascading Style Sheets | Introduction To CSS

The CSS Stands for Cascading Style Sheets. It is an extension to basic HTML that allows to style web pages. CSS describes how HTML elements are to be displayed on screen, paper, or in other media. CSS is nothing but a plain text file to store formatting properties web-pages and gives the control to make global changes and apply it to all web pages.

CSS is used to define styles for your web pages, including the design, layout and variations in displays for different devices and screen sizes. With css we can control the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background images or colors are used, layout designs,variations in display for different devices and screen sizes as well as a variety of other effects. In CSS the style definitions are normally saved in external .css files and with an external style sheet file, we can change the look of an entire website by changing just one file.

Advantages of CSS :

CSS saves time : CSS gives lots of flexibility to set the properties of an element. We can write CSS once; and then the same code can be applied to the groups of HTML elements, and can also be reused in multiple HTML pages.

Pages load faster : CSS enable multiple pages to share formatting, and reduce complexity and repetition in the structural content. It significantly reduces the file transfer size, which results in a faster page loading.

Superior styles to HTML : CSS has much wider presentation capabilities than HTML, so you can give far better look to your HTML pages in comparison to the HTML presentational elements and attributes.

Easy maintenance : CSS provide an easy means to update document formatting and maintain consistency across multiple documents. By making one change to the website's CSS, elements in all the web pages will be updated automatically.

Offline Browsing : CSS can store web applications locally with the help of an offline catche.Using of this, we can view offline websites.The cache also ensures faster loading and better overall performance of the website.

Multiple Device Compatibility : The Cascading Style sheets allow content to be optimized for more than one type of device. By using the same HTML document, different versions of a website can be presented for handheld devices such as PDAs and cell phones or for printing.

Global web standards : Now HTML attributes are being deprecated and it is being recommended to use CSS. So its a good idea to start using CSS in all the HTML pages to make them compatible to future browsers.

Versions of CSS :

CSS has three versions :

CSS1 : Cascading Style Sheets, level 1 (CSS1) was came out of W3C as a recommendation in December 1996. This version describes the CSS language as well as a simple visual formatting model for all the HTML tags.

CSS2 :  CSS2 was became a W3C recommendation in May 1998 and builds on CSS1. This version adds support for media-specific style sheets e.g. printers and aural devices, downloadable fonts, element positioning and tables.

CSS3 : CSS3 was became a W3C recommendation in June 1999 and builds on older versions CSS. it has divided into documentations is called as Modules and here each module having new extension features defined in CSS2.

Example of CSS :
<!DOCTYPE html>
<html>
  <head>
    <style>
      h2 {
    color: blue;
    background-color: yellow;
      }
      p {
    color: red;
    font-size: 12px;
      }
    </style>
  </head>
  <body>
    <h2> The CSS Test </h2>
    <p>Hello world This is CSS Test paragraph</p>
  </body>
</html>
Output :

The CSS Test

Hello world This is CSS Test paragraph

Next Topic :