Forum Moderators: open

Message Too Old, No Replies

HTML v.s. XHTML

which is the best?

         

fashezee

11:46 am on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do you choose between HTML or XHTML for a project, and why?

korkus2000

12:10 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have moved to creating sites in XHTML transitional. It really makes me code cleaner. XHTML is the future, so I think that it is the better choice for me.

universalis

1:47 pm on May 30, 2003 (gmt 0)

10+ Year Member



There are significant issues with XHTML that the vast majority of web authors don't address. When choosing, ask youself, what would XHTML give you that HTML can't? You can code cleanly in HTML too. Using XHTML 1.0/1.1 is "in" at the moment, but the case in favour is unconvincing at best, and fashion is not a good guide to wheter a technology is appropriate. (This is not to say that I don't like XHTML, but I don't think it's realy for prime-time just yet.)

You also need to consider whether to go for a Strict or Transitional version. If you can, I would recommend HTML 4.01 Strict (or XHTML 1.0 Strict if you must) - this will keep your code cleaner, more stuctural. You should use CSS for adding style, and make sure you validate all your code.

g1smd

8:24 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I can't see any compelling reasons to go beyond HTML 4.01 Transitional at the moment. Then again, I've never been into bleeding-edge technology.

TheWebographer

8:32 pm on May 30, 2003 (gmt 0)

10+ Year Member



I do not think XHTML is bleeding edge technology.

I prefer to code in XHTML. It makes me code cleaner and once I learned basic XML I understood the reasoning behind XHTML. Its a step in the right direction.

The WYSIWYG editor crowd - FrontPage and DreamWeaver - cannot generally be bothered with learning to code even HTML properly so why would they want to tackle XHTML?

Therein lay the gulf.

Mohamed_E

8:36 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I can't see any compelling reasons to go beyond HTML 4.01 Transitional at the moment.

I agree partially. I have no desire to validate beyond it, but I am gradually replacing <table ... align="center"> by a <div align="center">. Slowly, as it is a very low priority.

I think the major step is to move from "street HTML" to valid HTML of any flavor. Which flavor is much less important.

TheWebographer

8:40 pm on May 30, 2003 (gmt 0)

10+ Year Member



universalis - what are the significant issues you have found with XHTML?

drbrain

9:01 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



XHTML1.0/1.1 is just a redefinition of HTML4 on XML instead of HTML. Ian Hixie has written an article titled ending XHTML as text/html Considered Harmful [hixie.ch] to make content authors aware of the problems serving XML with the text/html mimetype.

I prefer to use HTML4.01 strict or transitional, because it doesn't use as much bandwidth as XML-based markup.

papabaer

9:36 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Boy, and who would've thought the W3.org would get it wrong?

Doctype as displayed in the W3C homepage:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"
xml:lang="en-US">

And bandwidth as an issue? Let's see.. if I recall, in migrating from HTML to XHTML, I trimmed my page code by approximately 40% on average. I guess those extra closing tags I needed didn't cause too much damage.

Forward is forward. Code as you please, it's a big world. I've made my choice.

papabaer

9:45 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And just to add more support to the XHTML choice:
http://www.w3.org/WAI/bcase/benefits.html [w3.org]

Use of XHTML & XML - use of these emerging language specifications (in conjunction with the appropriate use of style sheets) will make automatic conversions of content for alternative display even easier. XHTML and XML are ideally suited to machine manipulation of information.

Doctype from the above W3.org Auxiliary Benefits of Accessible Web Design page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

And from the New York Public Library Style Guide:
XHTML Guidelines & Benefits: XHTML is the standard markup language for web documents and the successor to HTML 4. Library projects must be authored in structural XHTML 1.0 Transitional.

http://www.nypl.org/styleguide/ [nypl.org]

aspr1n

10:09 pm on May 30, 2003 (gmt 0)

10+ Year Member



I have to say, I really think it's an irrelevant question, the spec is there, it's mature, well supported and powerful, the question should be why should you not bother.

Web technology will always be a journey rather than a destination, and engineers needs to get with the program, embrace, support and implement new standards as much as practicable, especially when they empower the end user.

Fundimentally though it depends on whether you buy into the "Semantic Web".

asp

TheWhippinpost

10:11 pm on May 30, 2003 (gmt 0)

10+ Year Member



Why NOT migrate to XHTML, it's not exactly rocket science!

mattur

10:12 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if I recall, in migrating from HTML to XHTML, I trimmed my page code by approximately 40% on average

Thanks for sharing your info pb, but unless you were going from well marked up html 4.01 trans using css to xhtml then, unless I'm missing something, this isn't really relevant.

I'm still waiting for a reason to move to xhtml, other than "because the w3c sez so..." The most compelling site to cite against your doctype cites, is err... well, Google? If it conferred an advantage, they'd be doing it :)

mattur

10:14 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And of course it's irrelevant if you use a decent CMS since you can rewrite html, *and* re-word titles, etc in a trice! ;)

aspr1n

10:22 pm on May 30, 2003 (gmt 0)

10+ Year Member



mattur, I soon as we went to well designed semantic xhml we got top 10 placements of all our targeted search engines - including google where we have a number of 1st places and a number of top 5's.

Guys this is quite literally about semantics (pun intended), what is semantically useful for a human is with xml semantically useful for a machine.

This good both for search engine placements and if you happen to be blind.

asp

drbrain

10:23 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



papabaer:
[validator.w3.org ]

Gives: This Page Is Valid XHTML 1.0 Strict!

So according to the relevant TRs, what exactly is wrong with that doctype?

Hrm, when I go home tonight, I'm gonna have to check and see what mimetype gets served to which browsers, in Mozilla its application/xhtml+xml, I wonder what IE or WebmasterWorldill recieve... [edit]err, that should be 'w' '3' 'm' ' ' 'w' 'i' 'l' 'l', not WebmasterWorldill[/edit]

They also have a http-equiv meta that says text/html...

But they do something incredibly clever!

<style type="text/css">
<!--
...
-->
</style>

As for bandwidth, I've got two made-up validating pages (HTML Strict and XHTML) with:
three headings,
a table with a header, footer, and body, one row of three columns in the header and footer, and four rows of three columns in the body,
two paragraphs

All elements are used semantically. Using HTML gives me a 297 byte savings. (The HTML version doesn't have: </head> </body> </html> </head> </tfoot> </tbody> </tr> </td> </p>)

Remember that the only real difference between XHTML and HTML is that XHTML is XML-based, and HTML is SGML based.

papabaer

10:42 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm still waiting for a reason to move to xhtml, other than "because the w3c sez so..." The most compelling site to cite against your doctype cites, is err... well, Google? If it conferred an advantage, they'd be doing it

Gee, I wonder where the valid HTML 4.0 that you choose to stick with came from? No matter, I know there were similar arguments against migrating from HTML3.2.

Google.. not yet, but FAST?
AlltheWeb... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

AlltheWeb.com made the transition several months ago.

As for bandwidth, I've got two made-up validating pages (HTML Strict and XHTML) with:
three headings,
a table with a header, footer, and body, one row of three columns in the header and footer, and four rows of three columns in the body,
two paragraphs

Ummm... you use tables? For tabular data only right? ;)

I was concerned about bandwidth... I abandoned table layouts over two years ago. Pure CSS... now we're talkin' bandwidth savings!

I'm still waiting to here about the "significant issues" against XHTML. But then again, not really. I already know how my code renders on Internet enabled cell phones, pdas and other emerging technologies, and after all, that is the primary motive behind the thrust to XHTML.

Nuff said. Have a good weekend.

mattur

12:30 pm on May 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This good both for search engine placements and if you happen to be blind.

Glad to hear about your search engine positions asp, but I have to take issue with this statement.

You don't need to use xhtml to achieve good SE results. And the semantic stuff doesn't really achieve anything unless everyone marks up their code consistently e.g. there is no w3c standard for how to markup breadcrumbs, global nav, local nav etc - presumably because these aren't semantic enough ;)

And xhtml or xml gives ABSOLUTELY NO advantage to visually impaired users. None whatsoever. Most visually impaired people use IE with Jaws. Semantics doesn't come into it. It's really important that folks understand this cos otherwise people might start thinking that marking up in xhtml alone makes their content accessible. Accessibility is not a syntax issue.

I don't buy into the semantic web idea(l), as you've probably guessed :)

aspr1n

3:20 pm on May 31, 2003 (gmt 0)

10+ Year Member



And xhtml or xml gives ABSOLUTELY NO advantage to visually impaired users. None whatsoever. Most visually impaired people use IE with Jaws. Semantics doesn't come into it. It's really important that folks understand this cos otherwise people might start thinking that marking up in xhtml alone makes their content accessible. Accessibility is not a syntax issue.

asp, at this point mouth a gasp, picks himself up off the floor, steadies his typing finger, and replies...

Mattur,

I am.... I am.... absolutely gobsmacked anyone can make that statement.... I know you're no newbie, but I think you're talking utter sh1t ;)

The orginal "what's best html vs xhtml" was a lame and useless question, but the question "Does XML convey semantic information better than HTML" is a question worthy of this forum, so I hope you'll forgive me but I've started a new thread to discuss this: [webmasterworld.com...]

So I hope you'll join me there ;)

asp

mattur

7:41 pm on May 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



asp, I think you've wildly misinterpreted my post. To be clear, XHTML, XML and the semantic web are different things. XML is a format, XHTML is HTML in XML format, and the semantic web is a concept. I use XML all the time, esp. SOAP stuff which I think has great potential.

I stand by my two points: xhtml gives you no SE ranking advantage and does not in *any* way improve accessibility.

It would be interesting to hear your explanation of why xhtml is more accessible than html...? :)

henry0

11:14 am on Jun 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'll like to look at XHTML in details

any good tutorials?

I do not figure out how one may trim code by 40%

thanks

regards

g1smd

1:36 pm on Jun 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Code trimming occurs by moving from bloated HTML code littered with duplicate tags, to CSS based layouts, with minimal HTML.

This, however, does not require a move to XHTML at the same time, though many people do do this.

Personally I'm still happy with HTML 4.01 as it does everything that I require.

henry0

1:50 pm on Jun 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I either use HTML with CSS and SSI
but most site I dev by using PHP and of course CSS
how does XHTML integrate or impact on PHP?
regards

mattur

4:32 pm on Jun 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is no impact on your php coding from writing xhtml rather than html, apart from modifying the html tags your script spits out, of course ;)

universalis

12:35 pm on Jun 2, 2003 (gmt 0)

10+ Year Member



universalis - what are the significant issues you have found with XHTML?

There are several issues, none critical, but important if you are making a serious attempt to adhere to the standards. The biggest hurdle, ignored by the vast majority of people currently using XHTML, is the MIME type conundrum. XHTML 1.0, according to the specification, should be served with the MIME type

application/xml+xhtml
rather than
text/html
. XHTML 1.1, again according to the W3C specification, MUST be served as
application/xml+xhtml
. Of course, Internet Explorer choke on anything with this MIME type, leaving the only reasonable option, which is to use a server-side scripting language or mod_rewrite solution to serve an appropriate MIME type to different browsers. If you don't bother with this issue, all browsers will treat your markup as HTML rather than XHTML. This is a problem, as valid XHTML is actually invalid HTML.

Secondly, a lot of XHTML authors reckon that if you add a few trailing slashes and an xmlns namespace to an existing document, you have an XHTML document. Ther trouble is, the vast majority of these documents contain errors, which will break the page if the correct MIME type is used. Such documents are definitively not forward-compatible, as once

application/xml+xhtml
is more widespread, vast swathes of current web sites using XHTML incorrectly risk to break.

Other issues include inline CSS and Javascript - if you use comment tags to hide such styles or scripts, they won't work in

application/xml+xhtml
documents, and putting such scripts in CDATA blocks can cause problems with backward compatibility. Also, both CSS and JS behave differently depending on the MIME type - again, breaking your page.

XHTML is XML, not HTML, and so you need to work in a different way. There are no advantages to using XHTML at the moment, unless you are combining it with MathML, SVG or other XML data. Better to write semantic, well-formed, validated HTML 4.01 Strict with CSS for commercial projects, and keep the XHTML for more experimental use.

g1smd

1:40 pm on Jun 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Those are among the issues that I am concerned about; and worded in a far better way than I would have been able to say it. I'll not be moving to XHTML until the MIME-type issues are sorted, CSS support is much better than now, and all common browsers are fully compliant with it. That is, I expect, compliant with XHTML 2.0 as 1.0 seems just an interim measure that isn't worth bothering with.

papabaer

1:49 pm on Jun 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So, using Occam's Razor, we have this as your objection: Webmaster's may not be writing valid XHTML and therefore invite potential problems.

Solution: write validating code and follow proper XHTML authoring principles as set detailed by the W3C.

papabaer

2:03 pm on Jun 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS support is much better than now, and all common browsers are fully compliant with it.

Excuse me. Wanna run that by me again? Don't make statements like that please... some might actually believe it.

Even Opera 7.11, arguably the most CSS enabled browser, is not "fully" compliant.

Secondly, a lot of XHTML authors reckon that if you add a few trailing slashes and an xmlns namespace to an existing document, you have an XHTML document.

Arguments that are based on presuppositions and blanket assumptions hold little validity.

I never ascribed to the theory that "if I stay in my house, I'll never have to worry about falling trees." Too limiting. Time to move on...

universalis

3:15 pm on Jun 2, 2003 (gmt 0)

10+ Year Member



Arguments that are based on presuppositions and blanket assumptions hold little validity.

Fair comment. I am guilty of making a blanket assumption in my last post, so perhaps I'd better clarify. XHTML can be used well, and is being used well in many places. However, you continue to get such travesties as espn dot com (who appear now to have given up horrendeous, invalid XHTML for horrendeous, invalid HTML 4.01 Transitional). Other web publishing tools like Movable Type base their default templates on XHTML Transitional, which often get quickly mangled by their users, putting the forward-compatibility of these sites at risk. Put invalid XHTML through an XML parser (as you do when specifying

application/xml+xhtml
), and you'll get a DOM tree and error message. You won't get this problem with HTML.

I don't think XHTML should be outlawed or even left unused, it is just that, despite it's qualities, I don't think it's ready yet for serious production use in a commercial context. In smaller-scale projects, techical documents (especially when combining XHTML with other XML content), or for advanced users, XHTML remains an excellent choice.

g1smd

4:42 pm on Jun 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> >> CSS support is much better than now, and all common browsers are fully compliant with it. << <<

>> Excuse me. Wanna run that by me again? <<

Umm. you missed reading the bit in front which said:

>> >> I'll not be moving to XHTML until the MIME-type issues are sorted, [and] << <<

This 32 message thread spans 2 pages: 32