XHTML vs HTML FAQ

Thanks for that, I get a big ugly error message :smiley:
Something to play with now!

A very comprehensive FAQ. New technologies should be used for a reason, not simply because they are newer, or have an X prepended to their names.

Too many designers think using <br /> and setting an XHTML doctype has instantly set them apart as members of a modern webalati

Thanks for that FAQ! :cool:

Sounds like an icecream/coffee for Italian web developers. :lol:

The FAQ should mention that XHTML does not support the target attribute. From what I understand you have to resort to some kludgy JavaScript similar to the following:

<a onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" href="abc">text</a>

Of course, JavaScript may be turned off. I don’t use target very often but sometimes it’s useful. It would be great if there was a non-JS XHTML alternative but I haven’t run into one yet.

Here I was thinking I knew a little something about xhtml/html/css and I read this. I’m completely blown away … I had no idea that xhtml’s present benefits were few and far between.
To top that IE6 and EVEN IE7 will not support xhtml!!!
… i know nothing …

Thanks for the great post!

XHTML “supports” the target attribute equally much as HTML4. It is included in Transitional, but not in Strict. Oh, and using onkeypress here does nothing but hurting keyboard navigation.

If it’s in transitional but not strict and JS is the only alternative, my view is that the capability is deprecated with no alternative good alternative. Of course we may be in transitional (or even quirks mode) for a very long time so perhaps doing transitional is okay.

i love XHTML websites! im planning to study XHTML 2.0 :wink: but how can i start? i dunno if my current browser will support that technology! :slight_smile:

  • HTML (or XHTML) is for structure and semantics.
  • CSS is for presentation.
  • JavaScript is for interactive behaviour.

Opening a new window is behaviour.

You should only use a Transitional doctype during the transitional (gasp!) period when you’re converting an old tag-soup document into semantic markup. It’s not meant to be used when creating new documents.

It’s <pre-html4-doctype> → Transitional → Strict
or <nothing> → Strict
(At least that’s how it’s meant to be.)

Awesome Tommy! Thanks for it :slight_smile:

Thank you very much for such a useful and concise article!

We shouldn’t forget also that XHTML provides a means of better standardising the way we code and therefore work, especially when working within a team of developers who might have gained a broad spectrum of HTML-based habits.

Since we as a team adopted XHTML, it has helped us communicate about coding techniques, QA code and look to develop useful templates for future use. little of this would have been possible if we had stuck with the almost formless HTML.

And how, exactly, is that? XHTML is not the same thing as web standards. You can – and should – be consistent when writing your markup, and separate structure from presentation and behaviour, regardless of whether you use HTML or XHTML. Especially since 99.99% of ‘XHTML’ sites don’t really use XHTML at all.

I’m honestly curious. How does XHTML provide ‘a means of better standardising the way we code’, compared to HTML? I’ve looked deeply into the topic of XHTML vs HTML, and I have found no evidence of what you’re claiming, so I’d appreciate very much if you could substantiate that claim and back it up with tangible evidence. :slight_smile:

[size=-1]I must assume he was referring to well-formedness being easier to write.

I was under the assumition XHTML has five predefined entities: (<, >, &, ", and & apos; or did I misread the post.[/size]

Thanks for the explaination. I just migrated a mini-app to use window.open instead of target so it’s XHTML 1.0 Strict now. I’m still not used to using JavaScript when it’s not technically required but the separation makes sense.

Well I have read and re-read these comments and posts, and can be considered a user of XHTML for no apparent reason other than lots of other people were. (and I like the green tick on FF that says I did at least something right today)

In my efforts to understand this better could we take the simplistic view that as long as validation is based on STRICT (HTML or XHTML) and that the choice of using HTML or XHTML is chosen based on your need (or lack) for say Javascript that you will be fine.

Especially as the apparent benefits of true XHTML documents for use on the WEB (I am ignoring extranet or intranet usage) appear to not exist as yet ?

Cheers

me, i believed that i could use any character entities :confused:

So xhtml is the new level of writing?

This was the point I was making in another thread: XHTML on a functional level may not provide a means of better standardising code, but I think it does on a conceptual level. XHTML has become the standard-bearer of web …um… standards. The emergence of XHTML, being a new variant of HTML, has forced people to look again at the way they’ve been doing things and realising that there’s a rising movement of people doing things in a way they hadn’t considered before.

Well, it’s not very clear, so it’s my fault if you misread it. :blush:

&#38;lt;, &#38;gt;, &#38;amp; and &#38;quot; are defined in both HTML and X(HT)ML. In addition, X(HT)ML defines &#38;apos;. What I was saying was that in HTML you can only use the first four, in XHTML you can use all five.

You can’t rely on that in XHTML (served as XML). The character entities are defined in the DTD, but browsers use non-validating XML parsers that don’t read the DTD. Gecko browsers have the list of entities hard-coded into the parser (IIRC), so it will work there. Others do not, and will only understand the five predefined entities.

When a document is served as text/html, it is HTML, and HTML parsers have the list of entities hard-coded. Really old browsers don’t support all entities, but the more common ones are widely supported.

I don’t know what gave you that idea. :confused:
XHTML is not exactly ‘new’ (the first specification came out in 2000). It’s not on a different ‘level’ from HTML either. It’s XML, which is different from HTML, but not necessarily better or worse except in certain details which I’ve tried to highlight in the first post.

So what you’re saying is that XHTML is better because lots of people say it’s better? There is lots of misinformation being used to promote XHTML: that it’s more strict and more semantic than HTML; that you cannot use CSS with HTML; that mobile phones require XHTML; that it’s more future-proof; that it renders faster, etc.

No! :mad: Please re-read the first post in this thread. XHTML is not a ‘new variant of HTML’. It is an application of XML, which happens to have the same element semantics as HTML. This may seem to be hair-splitting, but the difference is fundamental and anyone who ventures into using XHTML should understand it.