homepage Welcome to WebmasterWorld Guest from 54.196.206.80
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Should I use XHTML or stick with HTML?
one_mind




msg:594440
 8:06 am on Dec 8, 2005 (gmt 0)

Hi,

I am about to re write my very messy site html and was wondering if it was worth doing it over in XHTML instead of HTML 4.1

Can the main browsers work pretty much the same with XHTML? Is there anything i have to watch out for?

Also, which version should i use, 1.0 or 1.1?

Finally, what is the currently and most widely supported CSS, is it v1.1?

Thanks for any info :)

 

Mobull




msg:594441
 9:31 am on Dec 8, 2005 (gmt 0)

I always use XHTML these days. I don't know the difference between 1.0 & 1.1 except that 1.1 is using a very strict doctype.

Thing that is different with XHTML 1.x and normal HTML 4.0: For Flash movies I used to use 'embed' tags to show the contents in Firefox. This however is not valid XHTML. You'll have to use the Flash Satay method for that:
First link in Google when searching for "Flash Satay".

drhowarddrfine




msg:594442
 2:03 pm on Dec 8, 2005 (gmt 0)

Use HTML 4.01 Strict. Chances are your host serves pages as html so, if you use xhtml, browsers will treat it as html anyway. Also, IE through version 7 does not recognize pages served as xhtml/xml. Only modern browsers do.

Now, that said, if you wish to become more comfortable with the xhtml style, which is html reformulated with xml, you can use it just fine. xhtml will, one day, replace html. Version 1.1 is xhtml modularized but I wouldn't use it at this time.

There is no css1.1, only css1, but there is a 2.1 and 3. Technically, 2.1 is not finished but browsers support most of it. IE does a horrible job while the others are pretty good with it and have even moved on to css3 support. If you google you can find pages that show any inconsistencies/support for css2.1 but I think most people code to it.

You can google to find ways to embed flash which validates.

dragonthoughts




msg:594443
 2:15 pm on Dec 8, 2005 (gmt 0)

I would recommend XHTML 1.0. It'll give some level of future-proofing.

Also, if there is any possibility that you might use any languages (including British English) that might have some characters ouside the US ASCII range, then encode it with UTF-8.

pageoneresults




msg:594444
 2:28 pm on Dec 8, 2005 (gmt 0)

Use HTML 4.01 Strict.

That would be my suggestion too. After taking the route of validating XHTML 1.1 Strict and then realizing that there were some major issues after the fact, I then dropped back to XHTML 1.0 Strict. After working with that for quite some time, I switched back to HTML 4.01 Strict.

I value the member input here at the board. Many were suggesting that we stay with HTML 4.01 Strict as it is pretty much the middle ground and you are safe either way.

Don't worry, it's an easy change switching over to XHTML 1.0 Strict if you are HTML 4.01 Strict now. A few Find and Replace routines and you're good to go.

one_mind




msg:594445
 4:47 pm on Dec 8, 2005 (gmt 0)

Cool, thanks guys.

HTML 4.1 it is :)

pageoneresults




msg:594446
 5:56 pm on Dec 8, 2005 (gmt 0)

You're quite welcome!

HTML 4.1 it is :)

That should be HTML 4.01. ;)

Farix




msg:594447
 9:33 pm on Dec 8, 2005 (gmt 0)

I will also echo the other recommendations with going with HTML 4.01 Strict since IE will not be supporting XHTML as XHTML for the foreseeable future. Finally, XHTML will not future-proof your site; writing valid markup and adopting good coding practices will. HTML will continue to be support by browsers in the future; however, they may be less tolerant of errors.

StickyNote




msg:594448
 7:59 am on Dec 9, 2005 (gmt 0)

Are the previous recommendations of using HTML4.1 strict over XHTML in this thread primarily for 'ease of use'?
Cause using XHTML, makes me feel feel pretty uppity and smarty-pants. :-)

benihana




msg:594449
 9:42 am on Dec 9, 2005 (gmt 0)

StickyNote - you serving your xhtml as xml? or just as text/html, which really just makes it badly formed html?

How are you accounting for IE's inability to handle xhtml as xml?

StickyNote




msg:594450
 10:41 am on Dec 9, 2005 (gmt 0)

Hi benihana.
I am at the present using as text/html, which, as far as I know, is the only workable way. I am not sure if that makes it badly formed html. By following a few simple guidelines a few minor changes will allow HTML4 code to validate to XHTML.
It seems to me that XHTML(?) or somthing similar is the future, so trying to move that way. Understanding as Farix pointed out 'XHTML will not future-proof your site'.

benihana




msg:594451
 10:47 am on Dec 9, 2005 (gmt 0)

thats exactly what i mean - youre not really serving xhtml, just badly formed html. Its the browsers ability to not choke on badly formed html that lets it work at all.

there are workable ways to serve xhtml to browsers that can accept it, and reformat the code to html for IE, but for the average website its not worth it.

I hope this link is acceptable:

Sending XHTML as text/html Considered Harmful [hixie.ch]

StickyNote




msg:594452
 11:18 am on Dec 9, 2005 (gmt 0)

benihana
Thank you for your time and links.
I always validate each page and check with all major browsers.
One thing I had never tried was changing the doctype to HTML4. When I just did this and attempted to validate, the entire webpage validated except for some closing brackets in the header ' />'. Therefore, as you said, badly formed HTML.
Along with some points in the link you provided have no doubt changed my mind.
regards

topsites




msg:594453
 12:45 am on Dec 10, 2005 (gmt 0)

XHTML 1.0 is the first major change to HTML since HTML 4.0 was released in 1997. It brings the rigor of XML to Web pages and is the keystone in W3C's work to create standards that provide richer Web pages on an ever increasing range of browser platforms including cell phones, televisions, cars, wallet sized wireless communicators, kiosks, and desktops.

XHTML 1.0 is the W3C's first Recommendation for XHTML, following on from earlier work on HTML 4.01, HTML 4.0, HTML 3.2 and HTML 2.0. With a wealth of features, XHTML 1.0 is a reformulation of HTML 4.01 in XML, and combines the strength of HTML 4 with the power of XML.

As taken from:
[w3.org...]

Farix




msg:594454
 12:53 am on Dec 10, 2005 (gmt 0)

What use are those advantages if the browser can't handle XML in the first place and will interpret the XHTML as malformed HTML?

dragonthoughts




msg:594455
 8:42 am on Dec 10, 2005 (gmt 0)

Firefox & Mozilla do support the XHTML 1.0 either served as html or xml. I am not sure but I think Opera does too.

Firefox is rapidly growing and now accounts for around 20% of the browser market.

IE may be broken and behind the game, but it does accept XHTML served as html - even if it treats it as tag soup.

Maybe it is worth following w3c recomendations.

It is always worth validating pages at [validator.w3.org...] to find silly mistakes from hand coding

LBmtb




msg:594456
 9:20 am on Dec 10, 2005 (gmt 0)

I redid my site in XHTML 1.0 strict from HTML 4.01 and all the users on my message board says the site loads quicker and looks good. I had one guy test it on 3 browsers on his mac and all was good.

I don't know much about the technical details but I'd say go for it.

py9jmas




msg:594457
 10:01 am on Dec 10, 2005 (gmt 0)

Firefox & Mozilla do support the XHTML 1.0 either served as html or xml. I am not sure but I think Opera does too.

If the file is served as text/html, these browsers treat it as broken HTML, and that's exactly what it is.

The benefits of XHTML are only there when you serve it with an XML mimetype.

Farix




msg:594458
 1:18 pm on Dec 10, 2005 (gmt 0)

Firefox is rapidly growing and now accounts for around 20% of the browser market.

Not quite 20%, but IE is still the 800 pound gorilla among the browsers and doesn't support XHTML now nor in the near future.

IE may be broken and behind the game, but it does accept XHTML served as html - even if it treats it as tag soup.

That's more a reason to avoid XHTML for now. If the browser is not going to interpret XHTML as XHTML but malformed HTML instead, then there is no point in using XHTML to begin with because you lose all the advantage of using XHTML.

Maybe it is worth following w3c recomendations.

The W3C got ahead of themselves with XHTML. The web wasn't ready for XHTML and still isn't ready for XHTML. Right now XHTML is a bridge to far.

It is always worth validating pages at [validator.w3.org...] to find silly mistakes from hand coding

And if you can't do it the right way to begin with, then you shouldn't be doing it in at all. Using XHTML with the text/html MIME type defeats one of the principle goals of a webdeveloper, to create webpages which are as error free as possible.

Doing XHTML the right way means telling IE to get lost, but that is very unprofessional.

[edited by: encyclo at 6:16 pm (utc) on Dec. 10, 2005]
[edit reason] language [/edit]

mattur




msg:594459
 2:10 pm on Dec 10, 2005 (gmt 0)

I redid my site in XHTML 1.0 strict from HTML 4.01 and all the users on my message board says the site loads quicker ...

HTML's syntax is more concise than XHTML's, so if you want your pages to be as small (and fast) as possible, use HTML.

george123




msg:594460
 2:39 pm on Dec 10, 2005 (gmt 0)

"I would recommend XHTML 1.0. It'll give some level of future-proofing"
As an answer to that check your Video club at the corner and see how many VHS has and how many DVD.

StickyNote




msg:594461
 6:39 pm on Dec 10, 2005 (gmt 0)

I have changed my mind regarding XHTML vs. HTML.
I have changed my pages back to HTML 4.01 strict.
A grueling 5 minute 'search and replace' of DOCTYPE and a few ' />'s.

When HTML 4.01 is no longer recognizable to most browsers, I will take 5 more minutes and put em' back.
This issue all of a sudden seems less of a big deal than before to me?

encyclo




msg:594462
 6:40 pm on Dec 10, 2005 (gmt 0)

I tend to stick to HTML 4.01 in most circumstances, and I agree with much of the above. I would, however, like to play devil's advocate a bit in favor of XHTML syntax (not the MIME type,
application/xhtml+xml is a terrible idea to put in place on anything other than a test page).

One advantage of using XHTML 1.0 Strict is that it is easier to validate for a non-experienced user. Every tag must be closed in XHTML (can you remember all the exceptions in HTML?) and so coding "errors" which would pass HTML validations are more easily spotted with XHTML. For example:

<table border="1">
<tr>
<td>HTML vs. XHTML</td>
</tr>
<tr>
<td>Can you see the error?<td>
</tr>
</table>

The above is valid HTML 4.01 (OK, ignore the border attribute if you are using Strict!), but invalid XHTML: XHTML helps you get what you want, as you are unlikely to deliberately write the above.

As for future conversion, moving from HTML syntax to XHTML syntax is pretty easy, moving from HTML to XHTML as XML is a great deal harder than you would imagine.

pageoneresults




msg:594463
 7:39 pm on Dec 10, 2005 (gmt 0)

Okay, is this a test? ;)

<table border="1">
<tr>
<td>HTML vs. XHTML</td>
</tr>
<tr>
<td>Can you see the error?<td>
</tr>
</table>

Should be...

<table summary="Short summary of table contents.">
<tbody>
<tr>
<td>HTML vs. XHTML</td>
</tr>
<tr>
<td>Can you see the error?</td>
<td>Do I get a prize or something? ;)</td>
</tr>
</tbody>
</table>

encyclo




msg:594464
 7:52 pm on Dec 10, 2005 (gmt 0)

Close but no cigar, p1r, you're mising a
colspan in your example. ;) In fact, the problem with the example is that as a </td> is optional in HTML (but obligatory in XHTML) then it can be harder to debug tables when using HTML 4.01 - the final <td> creates a new unwanted table cell and the validator won't pick it out.

One other use for XHTML is when the tools or scripts you are using default to it: the PHP line-break function uses XHTML syntax, as do many CMS and other code-generation tools. It is often better to stick with XHTML 1.0 throughout rather than trying to rewrite the CMS code.

But like I said, I still prefer HTML. :)

StickyNote




msg:594465
 7:59 pm on Dec 10, 2005 (gmt 0)

Ah, I jumped from 'HTML transitional' to XHTML and did not realize that you would not get an error for unclosed tags in '4.01 strict'.

My version of TidyHtml does not catch it either, since, I suppose it's not an error in HTML4.01.

I will continue to test with XHTML for syntax problems.

Farix




msg:594466
 8:08 pm on Dec 10, 2005 (gmt 0)

encyclo points out a good reason why it would be nice to have a HTML validator where you can switch the optional end tags to required.

Oh, the fundamental problem with Encyclo's example, he attempts to use a one cell wide table when he should have used two divs--two paragraphs would have worked as well, but ended up with an unintentional, empty second cell in the second row ;)

JAB Creations




msg:594467
 4:25 am on Dec 11, 2005 (gmt 0)

If you're not interested in really pushing yourself to master clientside languages stick to HTML 4.01 Strict in my opinion.

If you have the ability to manipulate your .htaccess or use serverside code (such as PHP) and really want to learn and even master the latest and greatest go with XHTML but ensure you're serving the mimetype correctly.

<?php header("Content-type: application/xhtml+xml");?>

Of course you'd need to NOT serve this mimetype to IE...you could do a couple things...perhaps a new thread about whether you can use XHTML tags and change the doctype for IE via serverside...what would work best...hmm.

Also if you validate your stuff, (X)HTML, CSS, 508, WAI then when you change the mimetype so long as your stuff validates you should NOT have a major problem with anything save perhaps badly/uninformed written JavaScript.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved