Thursday, January 25, 2007

CSS - Weight loss for your code

One of the main drawbacks of traditional HTML web design is the tendency to produce almost insupportably large file sizes with anything but the simplest of page designs since formatting requires a substantial amount of code per component unless a rather plain 'default look' is to be retained.

Although there are a number of contributing factors, the burden of responsibility can largely be placed on the shoulders of font and other style tags which have to be added to every text element if an aesthetically pleasing result is to be achieved.

With web sites becoming more complex in their structure and appearance, this led to ever increasing document sizes as the years went on until the sheer amount of code required for presentation far outweighed the text contained within the page leading to slow loading times, a serious headache for search engine spiders and the coining of the phrase 'code to content ratio'.

Help became available to designers in the shape of CSS (Cascading Style Sheets).
Originally conceived in 1994 to provide an effective means for designers to control the appearance of their web pages, CSS became a W3C recommendation in 1998 and has been gradually gaining popularity within the web design community since about 2003.

By removing bulky text formatting code from HTML documents and placing it in a central data file which controls the appearance of the entire web site, CSS not only provides a means of achieving a more uniform overall appearance, it also serves to substantially reduce the size of each individual HTML document.

For example; to display text in a certain font, colour and in bold would require the following HTML code:
Note that < > brackets have been replaced with [ ] brackets to display the code correctly:

[font color="#0000FF" face="Arial, Helvetica, sans-serif"][strong]Example Text[/strong][/font]

Lots of code for very little content, as you can see.
With CSS controlled design however, the text can be displayed in the same manner with the use of a span tag controlled by the Style Sheet:

[span class="C1"]Example Text[/span]

Same end result, half the code.
If you repeat this process fifty or sixty times within a single page your code will be much more lightweight and easily indexed by search engines (if it is also W3C compliant).

Those of you not yet making use of Cascading Style Sheets to reduce the flab in your HTML would be well advised to read up on the technique.

Further information about CSS can be found at the W3Schools CSS Tutorial.


With many years of experience in the industry, Sasch Mayer is an accomplished SEO copywriter. He is currently working in Cyprus under contract to IceGiant Web Design. Visit the IceGiant site for quality web and graphic design, information and more, non-syndicated articles.

DiggIt! Del.icio.us Yahoo Furl Technorati Spurl Reddit Google

Friday, January 12, 2007

What is CSS?

1. CSS stands for Cascading Style Sheets.
2. CSS is the technology used to make the layout for WebPages.
3. CSS allows you to make changes to all of the web pages that link to the CSS file at once by changing a style in the style sheet. Instead of having to manually change every style in every HTML file.
4. They would save you a lot of time to say the least, especially if you have a large or multiple web sites.

Syntax

The CSS syntax is made up of three parts: a selector, a property and a value:

Selector {property: value}

The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces:

body {color: black}

Cascading Stylesheets Advantages:

1. The content is separated from the design.
2. You site uses less bandwidth and loads faster.
3. Your website will automatically gain better search engine results.
4. CSS is compatible with newer browsers.
5. CSS can be used to display the same content on different media.

So it gives you great control of your website and makes your visitors happy when they are surfing your website.

DiggIt! Del.icio.us Yahoo Furl Technorati Spurl Reddit Google

Tuesday, January 2, 2007

Tables vs CSS - Which is better?

When I started exploring the design possibilities of the internet back in 1996, NetObjects Fusion was (at that point) a revolutionary WYSIWYG editor that allowed you to place pretty much any components anywhere you wanted on the page. Unfortunately for Website Pros, Inc. Macromedia had also seen the potential in WYSIWYG editors and developed what is arguably the most popular web design tool ever - Dreamweaver.

Dreamweaver has managed to keep up with the requirements of the modern day web developer by constantly updating and improving aspects of its design, layout and functionality. With the latest release of Dreamweaver, Macromedia have again improved on various features but have also come to realise the potential and the need to support (in more detail) the new designer's technique - cascade style sheets (CSS).

Having always designed using table based layouts, I recently (less than 3 months ago in fact) decided it was time to look in more detail at CSS, to learn what it could do to improve the quality of my work, specifically in terms of positioning and layout of website elements. At that point I already had a basic understand of CSS and how to use CSS to influence text styling, link styles, table colours and borders etc. The challenge was (more clearly) to see if designing layouts using CSS instead of tables was (to me) easier and more beneficial - could I be persuaded to change despite my dedication to tables?

My choice of two books (which I'm still reading incidentally), are both written and published by Sitepoint. The first (The CSS Anthology - 101 Essential Tips, Tricks & Hacks) is an excellent practical guide, not only for beginners but also for people (like me) wanting to learn a bit more (or in fact a lot more) about the potential of CSS. Whether you want to know how to justify text, create a pure CSS drop down menu or implement a liquid, two-column layout, this book is an excellent start or continuation for anyone interested in CSS.

The second and probably more relevant book that I chose (again by Sitepoint) is the 2nd Edition HTML Utopia: Designing Without Tables using CSS. This book again goes over the basics of CSS, but in a more concise and brief manor. The main bulk of the book concentrates on more examples of positioning and layout. In short these are two books that I know I'm eventually going to read from cover to cover - two books that will always be to hand and provide the answer to my question when something goes wrong or I don't fully understand exactly what I'm doing (something that happens on a regular basis).

So what have I learnt in the last few months from reading these books, reading relational website articles and listening to peoples points of view on webmaster forums? Quite simply I was quite stubborn in the beginning. I had tried about a year ago to use CSS for layouts but hadn't got very far (although at that stage I had no books to use for reference). This time around I had the knowledge (or more accurately the books of knowledge) but was already expecting my own personal failure (based on my previous experiences). Luckily though I stuck with it and now know a lot more (although obviously not everything, by a long shot) about the potential of CSS.

Obviously (just by looking at my site) you can see that I have indeed changed from table based layouts to CSS layouts - but what truly changed my mind and would I ever go back to tables? Is this site simply a one off?


Visit http://www.michaelthorn.co.uk for the full article and other articles on web design, SEO and adsense!

DiggIt! Del.icio.us Yahoo Furl Technorati Spurl Reddit Google