Advertisement:

Cleaning Up Your Web Site

Cleaning up your Web Site

What is cleaning up your Web Site?

In the ever changing world of the Internet, your web site may be using code that is out of date, or even incorrect.

With the advancement of CSS, the world of web sites has become much more organised. This has given way to web design concepts that use much less code.

This is great for the search engines, as the smaller amount of code, the less work the search engines have to do to find the keywords in your web site.

Tables .vs CSS

Before CSS really took off, the majority of web page layouts were organised using tables.

The problem with tables is that they require quite a lot of code. Whereas CSS can acomplish the same results with much less code.

Although this is the case, some scenarios still require tables, therefore it really depends on what you are trying to achieve, rather than which code should I use.

If, for example, you want to display a table of data, then using the TABLE HTML code is most probably the best to use.

Whereas if you are looking to position certain information on the page, then CSS is most probably the answer.

Code examples

The two segements of code display exactly the same, but they use different HTML code.

Tables example

<table cellspacing="0" cellpadding="0" border="0">
    <tr>
        <td>
            <p>Hello<⁄p>
        <⁄td>
        <td>
            <p>World<⁄p>
        <⁄td>
    <⁄tr>
<⁄table>

CSS Example

<div style="width:100%">
    <div style="width:50%">
        <p>Hello<⁄p>
    <⁄div>
    <div style="width:50%">
        <p>World<⁄p>
    <⁄div>
<⁄div>

As you can see from the examples above, the code on the right has less code. Although both examples produce the same result.

On top of the fact that CSS can use less code than tables, there are also a lot more benefits from using standards compliant code.

If you use standards compliant code, then you have a greater chance of your web site working cross browser. This is a great benefit, as you can almost guarantee that your target market see your web site as you want them to.