[SOLVED] HTML or XHTML

This is a discussion on "[SOLVED] HTML or XHTML" within the Web Page Design section. This forum, and the thread "[SOLVED] HTML or XHTML are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 17th, 2007, 21:42
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 409
Blog Entries: 2
Thanks: 3
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
[SOLVED] HTML or XHTML

Hi guys,
I have read the article about choosing the right doctype in newsletter, what i want to know that if i don't use xhtml then what will i lose ?
Thanks...
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote

  #2 (permalink)  
Old Dec 17th, 2007, 22:21
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: HTML or XHTML

Well, do you mean Strict vs. Transitional or do you mean HTML vs XHTML?
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #3 (permalink)  
Old Dec 17th, 2007, 23:35
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: HTML or XHTML

Quote:
Originally Posted by marSoul View Post
if i don't use xhtml then what will i lose ?
Nothing.

...except an "X".
Reply With Quote
  #4 (permalink)  
Old Dec 17th, 2007, 23:45
Aso's Avatar
Aso Aso is online now
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,008
Blog Entries: 2
Thanks: 5
Thanked 23 Times in 20 Posts
Send a message via Skype™ to Aso
Re: HTML or XHTML

Oooh I hear a big debate about tag soup coming along...no?

Generally, if you're not using any of the XML features with XHTML, HTML 4.01 Strict is perfectly suitable.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote
  #5 (permalink)  
Old Dec 17th, 2007, 23:51
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: HTML or XHTML

Quote:
Originally Posted by MikeHopley View Post
Nothing.

...except an "X".
and neater code - the brawl begins
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #6 (permalink)  
Old Dec 18th, 2007, 03:24
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: HTML or XHTML

Well in my opinion, the code is as neat as the autor writes it.... You can have a compliant XHTML document that is bloated with unnecessary code and a HTML document that has been written without a single element in excess.

I always use XHTML due to the fact that it is a XML version of HTML. All of the HTML elements are still available but can also be parsed as XML due to the uniform structure required by such documents. I write applications with PHP and having all documents coded in XHTML allows me to use PHP's XML parsing functions to read it, parse it and manipulate it like any other XML document. As ASO says, if you don't plan to use the XML features there aren't any killer features to make one standard recommendation better than another.

XHTML has addition benefits when it comes to accessibility and devices that don't use a standard web-browser interface. A correctly written XHTML document can easily be used to generate output on text-brailes devices and any program that can parse XML. Having said that though, HTML will also do the same. The difference is that XHTML by its recommendation requires a strict, properly formed layout whereas HTML is not quite as firm in this enforcement. Any compliant XHTML document will can be translated but this isn't the same for HTML.

If you use HTML and find yourself slipping into lazy or messy practices, switching to XHTML is a good way of forcing yourself into correctly structured documents as your code won't validate any other way...

Hope that helps a little.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)

Last edited by Rakuli; Dec 18th, 2007 at 12:13. Reason: spelling error :o
Reply With Quote
  #7 (permalink)  
Old Dec 18th, 2007, 07:17
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 409
Blog Entries: 2
Thanks: 3
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: HTML or XHTML

Thnx guys,
So what i understand now is that if i dont need xml then i should use html strict 4.01, right ?
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote
  #8 (permalink)  
Old Dec 18th, 2007, 07:25
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: HTML or XHTML

No it's nothing to do with XML besides the rules that (almost) ever element must be closed.
It doesn't matter whether you use XHTML or HTML just use a strict doctype
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #9 (permalink)  
Old Dec 18th, 2007, 07:59
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: HTML or XHTML

Quote:
I write applications with PHP and having all documents coded in XHTML allows me to use PHP's XML parsing functions to read it, parse it and manipulate it like any other XML document.
Now that's a good reason for using XHTML.

As Alex said, the really important decision is to use a Strict doctype. And as Rakuli said, the quality of your code is unconnected to whether you use XHTML.

XHTML has certain pitfalls, which I listed in the article (the need for content negotiation, problems with google ads, and the "invalid user comment breaks entire page" issue).

All of these problems can be overcome. I don't find it to be worth the effort, given I have no use for XHTML over HTML. But if you are aware of the issues, there's nothing wrong with using XHTML.

Assuming, of course, that you're serving it with the correct MIME type -- otherwise it becomes invalid HTML, which seems a little stupid, no?

Last edited by MikeHopley; Dec 18th, 2007 at 08:18.
Reply With Quote
  #10 (permalink)  
Old Dec 18th, 2007, 08:35
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 409
Blog Entries: 2
Thanks: 3
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: HTML or XHTML

Ok, How you guys choose your doctypes ? i mean what factors are important for you to choose html or xhtml ?
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote
  #11 (permalink)  
Old Dec 18th, 2007, 08:43
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: HTML or XHTML

Quote:
Originally Posted by marSoul View Post
Ok, How you guys choose your doctypes ? i mean what factors are important for you to choose html or xhtml ?
I've never found a use for XHTML, so I always use HTML 4.01 Strict. Easy decision.

My approach:
  1. Does this project make use of XML, or modules such as MathML?
  2. If yes, use XHTML.
  3. If no, use HTML.
Reply With Quote
  #12 (permalink)  
Old Dec 18th, 2007, 09:26
marSoul's Avatar
Moderator
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 409
Blog Entries: 2
Thanks: 3
Thanked 4 Times in 4 Posts
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: HTML or XHTML

Thanks Mike,
Now i think i got it !
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Reply With Quote
  #13 (permalink)  
Old Dec 22nd, 2007, 23:19
Ed Ed is offline
Highly Reputable Member
Join Date: Jul 2007
Location: Cork, Ireland
Posts: 687
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: HTML or XHTML

Quote:
Originally Posted by MikeHopley View Post
I've never found a use for XHTML, so I always use HTML 4.01 Strict. Easy decision.

My approach:
  1. Does this project make use of XML, or modules such as MathML?
  2. If yes, use XHTML.
  3. If no, use HTML.
Why not learn XHTML and don't bother choosing?

I was all for HTML 4.01 - but - there's no winning. I have not met somebody who has not wanted XHTML in their site. People refer to it (HTML) as "old technology" - it's not, I know, but times do change and it's just like with everything.

I can easily spot that XHTML is the way everything is going, so rather sooner than later.

Thanks,
Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
Reply With Quote
  #14 (permalink)  
Old Dec 23rd, 2007, 00:57
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: HTML or XHTML

Quote:
Originally Posted by Vivara View Post
Why not learn XHTML and don't bother choosing?
Your comments sound all too familiar to my jaded ears.

My article "Choosing the best doctype for your website" covers these arguments in detail.

XHTML offers me nothing that I (yet) desire, and it does pose some potential problems.

I find the very idea of "learning" XHTML risible. What is there to learn? Its syntax hardly differs from HTML. I've already "learned" XHTML: it took me all of an hour or so; it only took so long because everyone else uses text/html (fools), so it was hard to find a valid example to work from.

Since 80% of visitors use a browser that has no support for XHTML, I'm in no hurry to use it. What's the point of serving them invalid HTML, when I can use valid HTML instead?

So this is what I would get from XHTML:
  • No benefits
  • Some complicating pitfalls (google ads, content negotiation, fatal error handling)
  • My code would be treated as tag soup, invoking browsers' error-handling routines
Gee, where do I sign up?
Reply With Quote
  #15 (permalink)  
Old Dec 23rd, 2007, 08:47
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: [SOLVED] HTML or XHTML

Interesting. I use xHTML Transitional. Is this still acceptable? You guys have me concerned now :P
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #16 (permalink)  
Old Dec 23rd, 2007, 08:51
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: [SOLVED] HTML or XHTML

Jack, I would never, ever, ever recommend using Transitional - always Strict wither it be with HTML or XHTML.
Reply With Quote
  #17 (permalink)  
Old Dec 23rd, 2007, 09:12
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: [SOLVED] HTML or XHTML

Thats fair enough, but how come?
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #18 (permalink)  
Old Dec 23rd, 2007, 09:27
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] HTML or XHTML

I think that Mike is being somewhat pessimistic about XHTML even though his points are valid.

There are issues with XHTML? Yes. Will they destroy your website? I think not. Tag soup is not so much a problem with XHTML -- the extensible part of XHTML means having HTML tags treated as XML; technically, they can be placed anywhere in a logical XML structure and still form a valid XML ocument -- but semantic web design means that tag soup websites are simply those that use HTML elements outside of their correct context.

CSS support in HTML allows a tag soup approach to coding in HTML 4.x documents as well. Consider the designer who uses CSS to style a semantically neutral <span> into a H1 heading and styles the <h1> tag down to a H6, placing it at the very bottom of the document. "Tag-soup" essentially means that HTML tags are used without concern for their intended purpose, the XHTML standard accounts for this. You cannot use a <title> tag in the <body> and you can't place a body in the <head>. XML would allow this provided the document was correctly formed but XHTML is merger of XML and HTML meaning that the document must be correctly formed and valid HTML.

As I mentioned above I always use XHTML strict or transitional (depending on whether I need to use the target attribute ) and have not encountered any problems with google ads or browser error handling.

Mike's concerns are valid but biased towards his preference -- exactly the same as my arguments favour my preferred option. I just wanted to point out that XHTML is not going to destroy your web design career whether you use the XML features or not and, in my humble opinion, a standard that enforces correct formedness in documents is never a bad thing.

Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #19 (permalink)  
Old Dec 23rd, 2007, 09:53
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] HTML or XHTML

"Tag soup" is actually such a generic phrase now that calling something "tag soup" just means "this code is messed up".

The reason you don't encounter problems with browser error handling is that browsers are good at handling errors. They've had a lot of practice. But personally, I prefer not to give them any errors.

Your "XHTML" is invalid HTML unless you send it as "application/xhtml+xml". Not disastrously invalid, but invalid nonetheless.

I've always said that XHTML is fine to use. Obviously it's not going to destroy your web design career. Used carefully, it's harmless -- as long as you don't mind your code being interpreted as invalid HTML.

I just think it's a daft choice for most websites.

Mozilla, Opera, and Safari all recommend using HTML 4.01 rather than XHTML.

Last edited by MikeHopley; Dec 23rd, 2007 at 10:01.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
XHTML V2 vs. HTML V5 c010depunkk Webforumz Cafe 1 Dec 17th, 2007 08:23
xhtml , html leckenby15 Web Page Design 3 May 30th, 2007 14:05
Converting from HTML to XHTML Aaron1988 Web Page Design 1 Dec 4th, 2006 15:09
help with converting HTML to XHTML sing2trees Web Page Design 4 Sep 20th, 2006 03:35
Learning HTML/XHTML Amari Web Page Design 3 Jul 1st, 2004 22:05


All times are GMT. The time now is 11:11.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved