CSS, or cascading style sheets, allows you to specify styles for the visual elements of your website. (See our article on What Is CSS? for a more involved explanation of CSS.)
You may be asking yourself, "Can't I just set all the visual elements of my web pages through my HTML code?" And the answer is, yes, you can. CSS hasn't been around as long as HTML, and there are lots of perfectly good websites out there written exclusively in HTML code. But CSS does offer some distinct advantages in creating the "look" of your website.
CSS Saves You Time
In HTML, if you want all your H2 tags to appear in bold, for example, then you have to insert that font tag every time an H2 tag appears. For larger websites, this can be both tedious and time-consuming. But when you use CSS, you can set all element types (in this case, H2 tags) to appear in whatever style you want (such as bold). No matter how many H2 tags your web pages have, the cascading style sheet will set the style for all of them at once.
CSS Saves Your Visitors Time
The key to a user-friendly website is a speedy load time, right? Since you're using less code in CSS than you would be in HTML (remember, you only have to set the style for each unique element one time), your pages will load faster for users.
CSS Gives You Design Flexibility
If you'd like certain types of web pages to have unique stylistic elements, you can create a separate CSS file for each type of page. Your customer service pages can look completely different from your "about us" pages, for example. And CSS offers more stylistic possibilities than HTML does, so you have more visual options at your disposal. So even if you're not the fastest coder in the West, you can still give your website a complex, professional look.
Are There Any Drawbacks to CSS?
CSS compatibility varies by browser type. So if your user's browser doesn't support your CSS file, he may not be able to appreciate all your beautiful stylistic elements. However, the HTML code will still be there, so make sure that your website has a well-designed basic structure. Don't let the bells and whistles of CSS lead you astray from building good, solid HTML code.
It's hard to retrofit an existing site with CSS. If all the benefits of CSS have you thinking that you should redesign an existing website, you might want to think again. Going into existing HTML to extract the stylistic elements is probably going to take a lot of time, and since HTML affects both style and structure, any careless mistakes you make in the retrofit could affect not only the look of your site, but even its basic functionality. If you have an existing website that's serving you well, don't risk the headache. Wait until you launch a new website, and build CSS into its design from scratch.