Skip to content
Sep 16 / kkrizka

Code in XHTML/CSS

Many of amateur web developers code using the old HTML standard, meaning that they do not close all their tags and their layout is using many tables nested within in each other. This is a bad practice, and it annoys many other web developers. However this problem is not going anywhere, because many browsers still support HTML code that is both valid and invalid. Moreover table layout is what they will teach students in high school IT classes, so they never get introduced to the new better methods. Also many get turned away because of the many different CSS attributes, and the incompatibilities between browsers. They think that the old HTML method is much simpler and easier to user, but they don’t realize that there are many other advantages of XHTML over HTML. Let me list a few.

  1. Easier to parse by search engines and other spiders
  2. Easier to change in the future, just edit one line in the stylesheet
  3. Easier to change a lot of different tags
  4. Many more options that are missing from HTML (ei: fancy borders, different list bullets)
  5. Faster loading times because of reduced file size

If you want more reasons about why switch to XHTML, look through Porgrammi.com’s list

5 Comments

Leave a comment
  1. Chen / Sep 16 2007
    • Karol Krizka / Sep 16 2007

      Yeah, this theme was not created by me. I have a list of thing to do to fix it a bit. I’m just a bit too lazy to do it. 😛

  2. Stephan Beal / Sep 17 2007

    “…and their layout is using many tables nested within in each other. This is a bad practice…”

    For years i’ve heard web designers bitch about using nested tables (or any tables at all) for layout control, but not one has yet been able to tell me WHY. i hear the “separation of content and layout” argument from time to time, but if using template tags to replace the content during page generation then that point is largely moot because the content and layout *are* separated.

    So… what is SO evil about using tables for layout? (Let’s not forget that it’s the only *portable* way to manage HTML layout. Even text-based browsers can work with tables.)

    • Karol Krizka / Sep 17 2007

      I used to think along the same lines as you for some time. But recently I realized that using a fluid layout was quite a lot more efficient. It also reduces the size of the whole website.

      This topic does deserve further discussion though, and I’m putting it on my To Blog list. :)

  3. Ankur / Nov 20 2007

    You shouldn’t encourage people to use XHTML – rather encourage them to use HTML properly. Take a look at your own Content-Type:

    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />

    You’re serving with an XHTML doctype and a HTML content-type. This is VERY WRONG(tm).

    > However this problem is not going anywhere, because many browsers still support HTML code that is both valid and invalid.

    And browsers support XHTML that is tag soup. As in XHTML served as HTML as in 99% of all XHTML sites, (including this one).

    Unfortunately,

    1. Easier to parse by search engines and other spiders

    They parse the content. XHTML or HTML doesn’t make much difference.

    2. Easier to change in the future, just edit one line in the stylesheet

    You mean you don’t use CSS with HTML? Actually stylesheets are harder for designers in XHTML than HTML. The tags must be lower-case and html tag is the main one rather than body in XHTML.

    3. Easier to change a lot of different tags

    No idea what you mean.

    4. Many more options that are missing from HTML (ei: fancy borders, different list bullets)

    Are you serious? This is CSS not HTML or XHTML and is present in both.

    5. Faster loading times because of reduced file size

    XHTML will almost always have a larger file size because it needs to be strictly valid or it’ll throw a fatal error.

    You’re right in saying there are advantages to using XHTML – I use it on my own site. BUT the benefits you’ve listed are for HTML. Designers SHOULD use HTML NOT XHTML. XHTML is XML. It’s for parsing by machines. It’s for using other namespaces. HTML is for “web design”.

    Arguing about table-based layouts is irrelevant – you do that in both XHTML and HTML.

    The real sin here is not using HTML – HTML is good. The sin is using XHTML and not knowing what it actually is. Because it’s certainly not a substitute for HTML, and serving it as text/html is almost akin to using ill-formed HTML anyway.

    Now, I don’t mean anything personally, but unfortunately, this prevailing view that XHTML is “better” than HTML is simply untrue and unfounded and is harming the web.

Leave a comment