Posted by: DOCSERVE | August 12, 2011

CSS(cascading style sheets) Overview

Cascading Style Sheets (CSS) have been seriously underated. Maybe it’s because web designers think it’s harder than what it is. The truth is, CSS is incredibly easy!

With CSS, you can define all your common styles in an external Style Sheet. This way, if you want to change every occurence of a style throughout your site, you only need to update one place.

This tutorial will show you how to implement CSS into your website. This tutorial will also show you how to create an external style sheet and link to it from your HTML page.

CSS is a language that you can use to define styles against any HTML element. These styles are set using CSS properties.For example, you can set font properties (size, colors, style etc), background images, border styles, and much more.

Cascading Style Sheets, level 1 (CSS1) became a W3C Recommendation in December 1996. It describes the CSS language as well as a simple visual formatting model. CSS2, which became a W3C recommendation in May 1998, builds on CSS1 and adds support for media-specific style sheets (e.g. printers and aural devices), downloadable fonts, element positioning and tables.

As of this writing, CSS3 is currently under development.

HTML has its limitations when it comes to layout. Sure, you have 6 different levels of headings and 6 different sizes of fonts. You also have tables, and you have control over alignment etc. These are good enough to get a reasonable looking document that shows the true structure of information. However, it’s a far cry from some of the excellent layout & design that we see in magazines and printed brochures etc.

CSS helps us achieve such layouts.

With CSS, you have much better control over the layout of your web pages. You can specify exactly how big a font will be, exactly where an element will be on a page, what the page will look like when printed, and much more.

CSS can also save you a lot of time, particularly when maintaining a large site. Also, the World Wide Web Consortium (W3C) recommends that web developers use CSS tags instead of HTML tags wherever possible. The W3C are gradually phasing out quite a few of these HTML tags.

Advantages of CSS

  • CSS saves time
    When most of us first learn HTML, we get taught to set the font face, size, colour, style etc every time it occurs on a page. This means we find ourselves typing (or copying & pasting) the same thing over and over again. With CSS, you only have to specify these details once for any element. CSS will automatically apply the specified styles whenever that element occurs.
  • Pages load faster
    Less code means faster download times.
  • Easy maintenance
    To change the style of an element, you only have to make an edit in one place.
  • Superior styles to HTML
    CSS has a much wider array of attributes than HTML.

Disadvantages of CSS

  • Browser compatibility
    Browsers have varying levels of compliance with Style Sheets. This means that some Style Sheet features are supported and some aren’t. To confuse things more, some browser manufacturers decide to come up with their own proprietary tags.

    Fortunately, browser compatibility is becoming less of an issue as the latest browser versions are much more standards-compliant than their earlier counterparts.

    css(doc)

 


Categories