Jump to content


Photo

Why you should convert to CSS


  • Please log in to reply
19 replies to this topic

#1 Donna

Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 13 July 2005 - 05:53 PM

What is CSS? - I hear some of you ask. Well, CSS stands for Cascading Style Sheets and they have been around since the early 1990's believe it or not. The Wikipedia definition (changed so that it makes sense!) is as follows: CSS (Cascading Style Sheets) is a language that describes the presentationform of a structured document.An XML or a HTML based document does not have a set style, but it consists of structured text without style information. How the document will look when printedon paper and viewed in a browser or maybe a cellphone is determined by a style sheet. A good way of making a document look consistent and easy to update is by using CSS, which Wikipedia is a good example of.

So, why should we use CSS?

There are many benefits of utilising CSS on your web pages. Before you skip to the disadvantages, I can tell you now that the advantages easily outweigh the bad points. Below is a short, descriptive list of reasons to make the change:


Save on bandwidth

The more HTML code you use, the large the file size of the page. It doesn't take a genius to work that one out - so the most obvious solution is to cut down on the amount of HTML (something that Yahoo! might want to consider sometime, probably saving them £100,000's). CSS will certainly help to cut down on the amount of code you use, for example, replacing all of your tags (which are now obsolete by the way) with simple style declarations.



In reducing your file size, you will in turn reduce the amount of bandwidth your website consumes each month, hopefully saving you money. Typically, a heavy HTML coded website can measure up to 80KB's in size (without taking images or other media into consideration) - using CSS can cut down the file size by approximately 30-40% - a potentially massive saving if your website is popular. To find out how much bandwidth you would save, check out this bandwidth calculator, provided by CJ Website Hosting.


Cleaner, clearer looking code


Usually, CSS code is written in an external style sheet - you can however, use inline styles. Because of this, not only will your page load faster because a) external files are cached by most browsers and :D a stylesheet loads in unison with your web page - it also makes for much cleaner, clearer code.



Still not convinced? Take the example below as hard evidence:


This code is written without CSS:

<table border="0" width="100%" cellpadding="10" cellspacing="0">
<tr>
<td>
<font face="verdana" size="7" color="#C71585">
<b>Welcome to my website</b>
</font>
</td>
<td align="center">
<font face="verdana" size="7" color="#00FFFF">
My website is entirely written using HTML, nothing else.</font>
</td>
</tr>
</table>

You can achieve exactly the same result using the following CSS...

body
{
font-family:verdana,arial,helvetica;
font-size:100%;
}
h3
{
font: bold 140% verdana;
color:#C71585;
}
#content
{
color: #00FFFF;
}


...and the following (tiny piece of) HTML code:



<h3>Welcome to my website</h3><div id="content">My website is written using the latest in web technology!</div>



Much nicer, I'm sure you'll agree.



Easy to update = less time consuming = cheaper to maintain!



If you use an external CSS file (which I advise you to do), simply changing the style declarations in this one file will allow you to change the appearance of your entire website. For instance, in the example above, you could quite easily instruct the browser to render the heading tag to the right of the page or you could make the content wrap at 100 pixels - all by changing the CSS. Don't get me started on what you can achieve with bulleted lists!


Accessible pages and DDA compliance



Visitors who are blind or visually impaired will prefer a CSS designed website far more than one not using CSS.




This is due to the fact that CSS follows web standards endorsed by the World Wide Web Consortium. Because of this, special web browsers (such as text only browsers which read the content out-loud to the visitor) can interpret the content on the page.


CSS will help make your website DDA compliant. The DDA is the Disabilities Discrimination Act, the Act makes it "unlawful for a service provider to discriminate against a disabled person by refusing to provide any service which it provides to members of the public", specifically mentioning websites.


Another benefit of using CSS is variable font sizes. CSS will allow you to specify a font size as a percentage, doing so will allow visitors with poor eye sight to enlarge the text size. Tip: Try increasing the font size of a page by holding down ctrl and scrolling the wheel of your mouse (if it has one). You will notice that most websites do not allow you to increase the font size (unless you are using the Firefox browser which forces it) because they use pixel measurements. And those that work but use tags (such as Google) are actually breaking the accessibility guidelines.


Generally, websites designed in css are accessible on all sorts of devices including mobile phones and PDAs. The majority of hand held devices will simply ignore the CSS, leaving behind a readable (but bland) web site behind. A table design however is likely to render too wide for the viewable region.


Increase your popularity in SERPS!


Sorry, there I go again with the acronyms. SERPS stands for Search Engine Result Pages - the set of links returned by a search engine in response to a user query.


I can imagine that some of you are thinking "pull the other one! How can using CSS make my website rank higher in Google or MSN!" - well, extensive use of tables and obsolete tags can confuse search engine spiders which crawl your website for content. Some can even confuse code with content, although the major search engines seem to be very good at stripping out every possible HTML tag or javascript snippet - but it takes up valuable processing power that they would rather spend elsewhere.


It doesn't take a genius to work out that, like humans, the search engine will start reading from the top of your web page and just like humans they want to find out how relevant this page is as soon as possible - so cutting down the amount of code will make it easier for the robot to find the relevant text. Research suggests that you will also score "brownie points" with search engines for having standards compliant code that can be rendered across all mediums.


Tip: A combination of well written HTML code, fully utilised CSS and unique, well referenced content is the key to a higher search engine ranking.


Disadvantages of using CSS

As previously mentioned, there arn't any real disadvantages of using CSS - the pros far outweigh the cons. To put it another way, CSS 'div based' design versus table based design is a bit like comparing Liverpool Football Club to Gresley Rovers. There's only ever going to be one winner and everybody knows it.

So on to the only disadvantage I can think of...


Old browser issues


Old browsers, such as the early versions of Netscape and Internet Explorer. may have a hard time displaying CSS, especially as CSS-2 is now available to use and only the most recent browsers support it.

The solution? Download the latest browser! Which reminds me of potentially one more disadvantage; giving yourself a headache whilst attempting to get your website to look identical in Internet Explorer and Firefox - doh! Oh well, practise makes perfect.


In Conclusion

If you are interested in re-designing your website to use CSS, I would start by learning the basics. Find a simple CSS tutorial on the web and work your way through some more complex CSS examples. Then, have a go at doing your own! You will more than likely hit some problems with cross-browser compatibility but you should find help on webmaster forums such as those found at www.webmasterworld.com and www.sitepoint.com.




About the Author
James Crooke is a software engineer at CJ Website Hosting. Research interests include Object Orientated Web Applications, SEO and Accessibility in web design.

#2 Zeerus

Zeerus

    Young Padawan

  • Members
  • Pip
  • 55 posts
  • Location:navigating the fringes of lunacy
  • Interests:anime, web design, sports, girls, halo 2, girls, other video games, and did i mention girls?

Posted 13 July 2005 - 06:21 PM

great article Donna, as usual
CSS does have its very distinct advantages, and it's all I have used for the past year. The only downfall, is it takes longer to code, and you can't do as much customization as with tables. But yeah, call me Mr. Standards.

the only time I will ever use tables is for tabular data, and complex photoshop templates that I don't feel like hand coding. When will P2L be converting, lol? I expected this version to be all DIVs

#3 ludwigw

ludwigw

    P2L Jedi

  • Members
  • PipPipPip
  • 823 posts
  • Gender:Male
  • Interests:Designer at Lee ter Wal.

Posted 13 July 2005 - 06:23 PM

Wow...that article is amazing and sums it all up so nicely :o

Go CSS...go CSS.....IE7 get CSS to render properly :D


Thanks Donna

#4 Blitz

Blitz

    Jedi In Training

  • Twodded Staff
  • PipPip
  • 307 posts
  • Location:California
  • Interests:Php, html, css, etc, band, trumpet, anime, my dog, TV, computers, video games, sleeping, marching band, sleeping, jazz, sleeping, metal, sleeping, classic rock, sleeping, music, jazz band, did I mention sleeping?, kicking the hell out of kids that won't take the time to spell or use proper grammar, my website, etc.

Posted 13 July 2005 - 06:56 PM

The only downfall, is it takes longer to code, and you can't do as much customization as with tables.

Meh, I never got tables. They were kinda confusing. I just sliced Photoshop and converted the tables. And then I figured the magic of CSS and DIVs. I just found them to be so much easier and customizable. But again, meh, to each his own.

Great article. At least now the W3C reccommendations are reaching places. I'm starting to code a CMS to use with XML. Because I just found out that XML owns MySQL databases.

#5 ludwigw

ludwigw

    P2L Jedi

  • Members
  • PipPipPip
  • 823 posts
  • Gender:Male
  • Interests:Designer at Lee ter Wal.

Posted 13 July 2005 - 06:58 PM

Never heard about the XML thing....


IE7 have announced that they will be supporting standards :D Yay!

#6 KS93

KS93

    Young Padawan

  • Members
  • Pip
  • 65 posts

Posted 13 July 2005 - 09:32 PM

Very very nice article. Maybe it will convice a freind that CSS is cool after all :)

#7 GazMurf

GazMurf

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 14 July 2005 - 05:37 AM

Brilliant article - explained a lot of cloudy issues I had about CSS and it's benefits.

#8 Sodlier_Pyro

Sodlier_Pyro

    Jedi In Training

  • Members
  • PipPip
  • 440 posts
  • Location:Virginia
  • Interests:Computers, web design, anything computers basically

Posted 14 July 2005 - 09:18 AM

I'm actually re doing my site, changeing the layout and coding it in CSS. CSS is so much easier than iframes, I develped my layout in a matter of hours rather than iframes which took atleast a day for me :D.

#9 blinek

blinek

    Jedi In Training

  • Members
  • PipPip
  • 377 posts
  • Location:Earth

Posted 17 July 2005 - 01:01 AM

Yes, I have been using CSS for a while and it is much more efficient :) .

~aeiko

Edited by aeiko, 17 July 2005 - 01:06 AM.


#10 designkai

designkai

    Young Padawan

  • Members
  • Pip
  • 145 posts
  • Gender:Male
  • Location:Australia

Posted 17 July 2005 - 03:25 AM

css is the greatest, altho i havnt yet converted from tables to css layout

#11 jcrooke

jcrooke

    Young Padawan

  • Members
  • Pip
  • 1 posts
  • Location:UK
  • Interests:Web Development

Posted 17 July 2005 - 04:52 PM

Hi Guys,

Thanks for the feedback on my article, I appreciate it ;)

#12 Woolfy

Woolfy

    Young Padawan

  • Members
  • Pip
  • 86 posts
  • Location:England.

Posted 18 July 2005 - 10:16 AM

As long as it will help users of my site (not up yet, need a good host - for free...) view, then I'll use it. I use CSS 1 or whatever already.

#13 Zeerus

Zeerus

    Young Padawan

  • Members
  • Pip
  • 55 posts
  • Location:navigating the fringes of lunacy
  • Interests:anime, web design, sports, girls, halo 2, girls, other video games, and did i mention girls?

Posted 25 July 2005 - 08:34 AM

The only downfall, is it takes longer to code, and you can't do as much customization as with tables.

Meh, I never got tables. They were kinda confusing. I just sliced Photoshop and converted the tables. And then I figured the magic of CSS and DIVs. I just found them to be so much easier and customizable. But again, meh, to each his own.

Great article. At least now the W3C reccommendations are reaching places. I'm starting to code a CMS to use with XML. Because I just found out that XML owns MySQL databases.

I have a Flash gallery on my website controlled completely with XML. Made it using a Flash component I paid for, but I had to do the XML completely myself. really cheap component too. only cost $20, worth the money

#14 Tudi

Tudi

    Young Padawan

  • Members
  • Pip
  • 42 posts

Posted 25 July 2005 - 07:08 PM

Not that I'm very good at CSS, but I think the idea of cleaner code is of extreme importance. I started learing C++ a while ago and when I had to design a more complicated program without functions, I'd always get stuck in my own code. The same thing applies to HTML and other embedded scripts you might be using.

I think there's a tendency in all programming languages to divide code fractions as much as possible. Functions in PHP, Java, C++, etc. , Actionscript division in Flash, now CSS...

#15 hobulus

hobulus

    Jedi In Training

  • Members
  • PipPip
  • 346 posts
  • Location:United Kingdom

Posted 14 September 2005 - 03:15 AM

Very Interesting and great article. Just setting out to try and expand into CSS... SO has convinced me it is the way forward. Have always coded and built designs in tables, but will definitely get into CSS now!
:D

#16 Apache

Apache

    P2L Jedi

  • Twodded Staff
  • PipPipPip
  • 778 posts
  • Location:London, UK

Posted 14 September 2005 - 10:14 AM

great article Donna, as usual
CSS does have its very distinct advantages, and it's all I have used for the past year. The only downfall, is it takes longer to code, and you can't do as much customization as with tables. But yeah, call me Mr. Standards.

the only time I will ever use tables is for tabular data, and complex photoshop templates that I don't feel like hand coding. When will P2L be converting, lol? I expected this version to be all DIVs

NOt as much sutomization as with tables? I will severly have to disagree with you.


with CSS you can change the look of a page by switching the style sheet, not any of the actual page. Just have a look at CSS Zen Garden and then you will see that CSS offers a zillion times better customization.

Also I dont believe it takes longer to code than tables. I myself prefer coding CSS not only because of all the reasons above n the article, but I also believe it is faster to code once you get the hang of it

#17 Phyrriz

Phyrriz

    Young Padawan

  • Members
  • Pip
  • 19 posts
  • Location:Sweden, Sundsvall
  • Interests:Doing some work in C++ or ASM, PHP/ASP.

Posted 16 September 2005 - 09:05 PM

I've been doing stylesheets for quite a while now, first i've done XHTML then i went to CSS. Then, like 2 days after, i learned the whole programming language, and i started with XML. A tip for evreyone: HTML is gonna be out-to-date; so i suggest you learn XHTML for keeping you're design as good as possible!

Is this included CSS2.0, Donna?
EDIT: A good thing about CSS, forgot to mention, is that you can build very nice sites with very few images! T.S.

Edited by Phyrriz, 16 September 2005 - 09:06 PM.


#18 Spyder

Spyder

    Jedi In Training

  • Members
  • PipPip
  • 438 posts
  • Gender:Male
  • Location:London, UK

Posted 17 September 2005 - 03:24 AM

I am converted,

PS: great article

Edited by spyder, 17 September 2005 - 03:25 AM.


#19 saferwaters

saferwaters

    Jedi In Training

  • Members
  • PipPip
  • 390 posts

Posted 26 September 2005 - 02:54 PM

Nice article once again Donna, Im already on the CSS train, and I can tell you, its much easier than editing ten thousand <table> and <tr> tags...

#20 ThorX

ThorX

    Young Padawan

  • Members
  • Pip
  • 9 posts

Posted 27 September 2005 - 04:40 PM

I agree, i love css, so much better than plain html.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users