Code in XHTML/CSS

Karol Krizka @ September 16, 2007

Programming

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

Did you enjoy this post? Then why not subscribe to my RSS feed or subscribe by e-mail? Also check out the many other FREE ways to appreciate a blogger.


Related Posts

RSS feed | Trackback URI

5 Comments »

Comment by Chen
2007-09-16 15:04:06

Seems like you’re having some validation problems yourself! Shouldn’t be too hard to fix though.

Comment by Karol Krizka
2007-09-16 17:35:06

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. :P

 
 
Comment by Stephan Beal
2007-09-17 07:59:18

“…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.)

Comment by Karol Krizka
2007-09-17 12:18:46

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. :)

 
 
Comment by Ankur Subscribed to comments via email
2007-11-20 13:26:29

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.

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line=""> in your comment.

Feed