Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

eclipse

macrumors 6502a
Original poster
Nov 18, 2005
989
14
Sydney
I'm just trying to find out if HTML is now actually replaced by xhtlm standards... ? Which is the safest way to code, and why?
 
so...

Well okay, so what?
Yes, HTML 4.01 is as valuable as XHTML 1.0 in a daily usage. The syntax proposed by XHTML 1.0 has several important benefits. The weight of these benefits has to be evaluated in the context of your project: Use the right tool for the right job.
For a Web designer, starting to use XHTML 1.0 will be helpful in some circumstances and will certainly help you to smoothly negotiate the future. XHTML 1.0 gives a wonderful opportunity to learn about XML languages and their possibilities without having to learn new semantics because you’re working with familiar tags and attributes.

What's that mean? Should I use HTML or XML on my next project? The OP asked a fair question, I don't think you should just ignore him/her.
 
Not only that, but one should clarify either XHTML transitional vs. strict. The OP asked what is the "safest" to use, but did not clarify specifically what qualifies or quantifies "safe".

To me, that means the least amount of problems rendering the code cross browser compatible. To others it might mean the easiest to learn. To still more it might mean the least security vulnerabilities. To yet more it might mean simply the one where over time the code will remain compliant.

There is no single answer to all these, but I will say this much (my .02):

XHTML 1.0 strict technically is an XML application and has the toughest syntax, it involves COMPLETE separation of style from content, and one needs to learn not only XML and CSS in depth, but also deal with a few variances (i.e. "id" is used in anchor tags, not name attribute just to name one). All tags must be properly nested, closed, in lower case and have only one root element. If one uses the correct DTD at the top of their code, follows all the rules and validates the page properly the user will benefit from less HTML and increased cross browser rendering support. Meaning, the site will look the same across most browsers if not identical, darned close since XHTML 1.0 strict standards are well defined and well supported.

The transitional form is a mixture with loose syntax between both the HTML 4.01 and XHTML worlds and is easiest to learn and the easiest code to port from HTML.

HTML 4.01 is just fine for most these days for most uses, honestly. I'd suggest learning XHTML transitional and then progressing to strict for jobs that require adoption of the toughest standards for ALL of the reasons I stated above when I described "safe".

All are related so the learning curve is not incredible, one just needs to scan over the XHTML W3C specification and maybe reference syntax through the W3C schools site. (actual links provided)

Remember, there is alot more to this than what I mentioned - this is just a general overview and my .02, by no means the law of the land.

-jim
 
XHTML is, perhaps unfortunately, fairly useless on the web. Internet Explorer doesn't support parsing XML. You can serve it as text/html, but that will cause all browsers to parse it as HTML (invalid HTML, since it's actually XHTML) instead of XML. Also most browsers that *do* support it aren't quite as fast at parsing XML since it hasn't been as much of a priority. Most "XHTML" sites on the web are not being parsed as XHTML, and would probably have subtle errors if they were (for example, macrumors claims to be xhtml, but doesn't put its scripts or styles in CDATA sections).

If for some reason you need XHTML, you can detect which browser is requesting the page and return the appropriate content type. I haven't run into any situations where this actually makes sense to do though.

TLDR summary: Write valid HTML4 + CSS in most cases.
 
Hi all
by "safe" I guess I meant some of the things SrWebDeveloper referred to, especially:-
* "safest" to invest in learning because it IS the future and...
* it works on the most browsers now
Cheers in advance.

(edit to add: this Lynda.com training video — free sample file 11 minutes long —*says XHTML is definitely the future.
See the introduction 11 minute video.
http://movielibrary.lynda.com/html/modPage.asp?ID=48 )
 
Hi all
by "safe" I guess I meant some of the things SrWebDeveloper referred to, especially:-
* "safest" to invest in learning because it IS the future and...
* it works on the most browsers now
Cheers in advance.

(edit to add: this Lynda.com training video — free sample file 11 minutes long —*says XHTML is definitely the future.
See the introduction 11 minute video.
http://movielibrary.lynda.com/html/modPage.asp?ID=48 )

This topic has been talked about here at Mac Rumors a couple times before. It's a bit of opinion really (___ is the future! hah, it's all opinion). I'm a XHTML Strict person, but browser developers are getting behind HTML 5 more (support for video tag as example) than they are XHTML 2, despite XHTML being the more logical (in most cases) move forward. Learning both HTML/XHTML is the way to go, the differences are small it's hardly any extra learning for the most part, and IE is going to slow things down so much you'll have plenty of time to learn things.

My only suggestion is that you learn enough to use a strict DOCTYPE that validates, either for HTML 4.01 or XHTML 1.0. And if it wasn't clear so far, HTML has not been replaced. HTML and XHTML are very likely to co-exist for a long time to come, and that's OK really.
 
...(for example, macrumors claims to be xhtml, but doesn't put its scripts or styles in CDATA sections). TLDR summary: Write valid HTML4 + CSS in most cases.

FYI, MacRumors uses XHTML 1.0 TRANSITIONAL - the looser of the two XHTML specifications which really is HTML 4.01 extended, so it's not surprising they don't use CDATA. I checked the DTD to be sure. I also agree with angelwatt that STRICT is the way to go regardless of the specification type. Please note for the record HTML5 and XHTML2 are in working draft status, not officially adopted by the W3C as of this writing.

-jim
 
FYI, MacRumors uses XHTML 1.0 TRANSITIONAL - the looser of the two XHTML specifications which really is HTML 4.01 extended, so it's not surprising they don't use CDATA.
-jim

The doctype doesn't really matter for that. If it's parsed as XML, it has to be *only* XML, so non-XML languages have to be in CDATA. If it's parsed as HTML, then from the browser's point of view, you're using HTML. Since macrumors has to work with IE (plenty of Mac users browsing from PCs at work, for example), it has to be parsed as HTML, so CDATA usage isn't enforced.
 
Jim Goldbloom, Sr. Web Developer
Lack of planning on your part does not constitute an emergency on mine!

Someone been reading the "Boundaries" books? :)
 
The doctype doesn't really matter for that. If it's parsed as XML, it has to be *only* XML, so non-XML languages have to be in CDATA. If it's parsed as HTML, then from the browser's point of view, you're using HTML. Since macrumors has to work with IE (plenty of Mac users browsing from PCs at work, for example), it has to be parsed as HTML, so CDATA usage isn't enforced.

True, but we all know the W3C and the browser world are not in sync regarding XML parsing as an application vs. HTML as text. I was referring to the third parameter in the doctype used to define the syntax for validation purposes, the DTD file. That can be customized to override or extend a default DTD (which MacRumors uses, CDATA usage is not enforced in the standard). When you quoted you left off the part when I said "I checked the DTD to be sure".

-jim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.