CSS is used to style a web pages content. As XHTML is not meant to contain any information in regards to the web pages layout or formatting, CSS is the tool you use instead.

Something I see on a day to day basis is web developers using inline styles. This is really bad practise and should really be refrained from. The only examples of inline styling in which I believe to be acceptable is possibly in forum posts or one-off, single pages. However, other than this all javascript should be included from an external file. Let me explain why: -

HTML File Size

If all your styles were contained within the XHTML file, then the file-size would probably be at least double than if you had used external stylesheets.

<div style="width: 200px; height: 100px; background-color: #FF99CC; padding: 10px;">

This could easily be replaced by using the following code:

<div class="myClassName">

Not only will this save you space precious bandwidth, it makes the code look cleaner and easy to read.

 

Lack of Caching

HTML code should never be cached, so every time the browser is refreshed it will have to fetch the entire page again from the server. However, external files such as stylesheets and JavaScript are cachable by the clients web browser. In the current day and age, people want their information delivered instantly, so waiting longer than necessary for HTML files to load is not acceptable. By including the styles separately, the cached version on the clients browser can quickly and easily load up the files rather than being sent via the internet. For large, style and JavaScript heavy pages this will save crucial seconds per load.

 

Search Engine Spiders Don’t Like it

Search engine bots such as “Googlebot” are always looking out for and indexing new websites to their database. As search is such an important commodity for online visitors, making your source code as readable and optimized for search engines as possible is a must.

Adding styles in line ”junks up” your code and will begin to dilute your targeted keywords marginally.

 

Following W3C Web Standards

It is important that your website follows W3C Standards. You can run simple checks on your web pages to check for any HTML errors or warnings.  The W3C standards were introduced to ensure web unity, allowing your web page to be displayed exactly the same across every standard obeying web browser. It is considered bad practise by web professionals not to follow the W3C standards, since HTML was never intended to control style, positioning or formatting. It will also be frowned upon by search engines who are looking to index your website, they too are looking for the web standards.

 

Ease of Maintainence

When it comes to maintaining your website, it can become a tedious task trying to locate all the sources of where style information is being held. If their is a mixture of internal stylesheets, inline styles and external stylesheets, there are already at 3 places to look. Furthermore, if a style is being repeated across multiple locations and is being provided in-line, then there will be multiple changes to be made, taking time and effort. Maintaining code in this way would end up driving the developer mad.

 

Accessibility

Keeping the code clean, tidy and error free makes life easier for the tools required by disabled people to access and read the information on your website. If you are a business, accessibility is a legal obligation so making it as accessible as possible is a high priority.


 

Tags: , , , , , , ,




Related Info
If you are into mining, no matter if it is gold, coal, heavy or light mining, when lookin for you should always consider to compare new mining equipment cost to costs.

For a slow PC or to correct most of the errors on your PC, you should try the and get your PC speed back.

These Christmas gift baskets and holiday gift ideas make great presents.

If you own an iPad and you are asking yourself than you just have to read this . Discover the full potential of your iPad.

Online education is also a great invention which comes with the help of information technology and online degree programs.

 

No comments

Be the first one to leave a comment.

 
 

Top 100 Writers – Niche Sites

Here are Top 100 Writers sites that specialize in specific niches:

Games
IT
Weight Loss
Hosting - Available
Computers - Available
Home - Available

More Links

Error: unable to get links from server. Please make sure that your site supports either file_get_contents() or the cURL library.