Benefits of CSS

Benefits of Cascading Style Sheets

Deprecation of most HTML formatting elements used in In HTML 4.0 means that, even if the browsers still support them, according to the recommendation of the World Wide Web Consortium (W3C) they should no longer used. It is rather recommended that Web designers apply CSS.

The biggest advantages of CSS are:

  1. Cleaner code
    • Easier maintenance
    • Faster downloading
    • Better optimization of search engine
  2. Modular code
    • Style rules can be used with multiple pages
    • Consistent design
    • Easier maintenance
  3. Design Power
    • Precision of control (position, size, margins, etc.)
  4. Division of labor
    • Developers’ task is to develop / Designers’ task is to design
  5. Better Accessibility
    • Tags are no longer misused (e.g, <blockquote> for formatting)
    • No need for invisible images don’t need to be positioned
    • Users can override authors’ style sheets

CSS Rules

CSS rules comprise definitions of the style of an element or a group of elements. They use the following syntax:

selector {property:value; property:value; property:value}

All property:value pairs are declarations. Multiple declarations are separated by Semi-colons are used to separate multiple declarations. The selector determines the elements that are affected by the rule. Let’s consider the following rule.

p {
 color:darkgreen;
 font-family:Verdana;
 font-size:10pt
}

This rule determines that all paragraph text should be darkgreen color and apply a 10-point Verdana font.

CSS Comments

Comments in CSS start with “/*” and end with “*/“. Look at the following example.

p {
 color:red; /* All paragraphs should be red */
}

Leave a Reply

Your email address will not be published. Required fields are marked *