Jump to content

Html Or Xhtml? [Updated: 14 Sept. 2011]


LSW

Recommended Posts

{NOTE: This is an older post, older than the date shown & I believe ported over from the old forum of years ago. With the growing use of HTML5, this is becoming a purely academic argument/posting. Once HTML5 becomes the new standard in 2014 or so, it will just be of historical interest.}

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

One of the most important cornerstones to Accessibility is using W3C Standards. That means you need to understand them as well. No small feet.

 

Clearly the first stop is the W3C (World Wide Web Consortium) itself.

 

So what language to use? Short answer, whichever you prefer, but here is what you should consider. Below you will find some good links on these subjects.

 

HTML

 

Html is still a Standard and the newest version of HTML available. Some still believe that XHTML replaced HTML (something I believed 1 1/2 years ago as well) and HTML is retired. Wrong.

 

HTML 4.1 and XHTML 1.0 were both released in 1999 and are equal standards, niether better or worse than the other. HTML is fine to use and no reason not to.

 

What I would strongly suggest is that you however serve it with the Strict DOCTYPE. That is how it is meant to be served, that is pure HTML as it is meant to be written. But more on Strict and Transitional another time.

 

Also I strongly suggest you write HTML as close to XHTML as you can to get into the habit. This means always write in lower case, never should any element, attribute or name ever start with a capital letter, that should be avoided. Also be sure to wrap all attributes in "", so rather than Border=1, write border="1".

 

[Edit: 2011 - HTML 5 is a hot topic and is now being used and suggested by many developers. This is possible, but you must understand that HTML IS NOT a standard. The standard at this time is still HTML 4.1. HTML is currently (Sept 2011) in "last call" and open for use and comment by developers. It is not expected to become a W3C "Recommendation" until 2014, so acceptance as a new standard is unlikely until 2015.]

 

XHTML

XHTML is falsely understood by many to be a later version of HTML that looks a little like XML (Extensible Markup Language). Wrong!

 

XHTML is a XML Language that is formatted to look like HTML. But being XML it requires lower case names and all tags must be closed including empty tags like

<img ....="">.

 

Now it gets complicated.

 

XHTML 1.0 - A very morphed version. It was created to "Help" us get used to XHTML ad XML. But it is very backwards compatible. It even carried forward that bad W3C habit of Frame, Transitional and Strict DOCTYPES. It is a very lax language you can even serve as HTML.

 

XHTML 1.1 - A step to real XHTML, very modulerized. No longer has Transitional, Frame and Srict DOCTYPE, it is simpy strict. It must be served as application/xhtml+xml.

 

XHTML 2.0 - Not released yet, this is not compatible with HTML at all. Must be served as application/xhtml+xml. [Edit: 2011 - The XHTML 2.0 development group's charter ran out in 2010. Currently it is no longer being developed although it can be re-started in the future.]

 

Also such JavaScript such as document.write() will not work in XHTML served as XML, you will have to learn to create JavaScript with the DOM (Document Object Model).

 

You will also no longer be able to hide CSS in your pages as the SGML style comments no longer work (), nor can you use inline styles anymore. So all CSS must be in either external sheets or in the head using , this is more trouble then likey worth it so best to simply use external style sheets.

 

So that brings me to TagSoup.

Tag Soup is serving XHTML as HTML. You see when a page is requested it goes to a server with a "Header" that explains what language it accepts. HTML is served as text/html.

 

Now when I write a simple XHTML page, it is still being served as text/html. It is written as XHTML but served as poorly written HTML. This works with XHTML 1.0 but not the others.

 

The problem comes with serving XHTML correctly as XML. IE does not understand that and tries to download the page! So to work in IE you have to use "Content negotiation". For instance a PHP script that says if it accepts application/xhtml+xml, if not it serves it to IE as text/html.

 

Also when served as XML, you can no longer use such things as for comments as that is HTML and not XML. I you use XML comments and serve it as HTML, those comments will show.

 

So at this point XHTML is not truelly supported. You can write XHTML but by servig it as HTML you loose all advantages like working with MathML or SVG.

 

So when it is all accounted for, the trouble of working with correctly served XHTML with todays browsers.... it is not really worth it.

 

If you are just doing a simple site with no need for SVG or MathML and such things, then it is fine and easier to use HTML, just do it Strict as it was meant to be used and keep coding as close to XHTML as you can with lower case and "" wraped attributes.

 

----------------------------------------------------------------------------

For more on this subject, or as proof that this is not something I dreamed up when bored [:D] here are some handy links on the subject:

Link to comment
Share on other sites

  • 1 year later...
Guest hummert

Hi, thanks for discussing the problems with X-HTML that is an advanced version of HTML.

Thanks!!

Edited by Andrea
Link Removed
Link to comment
Share on other sites

With recent developments in HTML 5 and the continued problems of XHTML with IE, it seems clear to me that strict HTML 5 will dominate and XHTML will fade away over time.

 

Stefan

I am sure that none of us will be crying over it. I never did care for XHTML and I would certainly jump for joy when it time to use HTML5 on a everyday basis.

Link to comment
Share on other sites

  • 5 months later...

For a while, people thought that HTML would be replaced with XHTML (me too) - I don't know why/how this misconception came about, but ti's not dying easily. It's safe to ignore it and stick with HTML - you can find more info if you follow the links the first post here gives you.

Link to comment
Share on other sites

I am not up on the latest, but HTML5 will not replace XHTML any more than XHTML replaced HTML 4.1.

 

They cannot replace each other as they are two different languages.

 

HTML (4.1 & 5) a mark up language for normal web sites.

 

XHTML is an extended mark up language written in XML. It is meant to run XML tools such as SVG & MathML.

 

HTML's job is normal web sites.

 

XHTML's job is XML language sites.

 

HTML 5 can no more replace XHTML than JavaScript replacing Java. They are all totally different animals.

Link to comment
Share on other sites

  • 4 months later...

The most important difference between HTML and XHTML

 

1. It allows an author to omit certain tags and use attribute minimization.

2 The Extensible Hyper Text Markup Language, or XHTML, is an application of XML (Extensible Markup Language). It doesn't allow the omission of the tags.

 

This means that in XHTML we need to use </br> tag with <br> tag.But in HTML, we can use only one </br> tag in place of <br> and </br>

Link to comment
Share on other sites

...in XHTML we need to use </br> tag with <br> tag.But in HTML, we can use only one </br> tag in place of <br> and </br>

 

This is not correct - in XHTML, to create a line break, you do NOT use </br> WITH ,<br> - you use just the </br> tag.

Link to comment
Share on other sites

In HTML the <br> tag has no end tag.

 

In XHTML the <br> tag must be properly closed, like this: <br /> (note the space)

 

 

 

Darn - I had it backwards. That's what happens when you use HTML mostly. Sorry.

Link to comment
Share on other sites

  • 3 months later...

How can you compare the two languages? XHTML 1.1 is XML and HTML 4 is HTML. It would be like comparing Java Script to PHP.

 

I haven't kept up to much... but aren't they finally doing away with those stupid transitional/strict designations with HTML 5? They should.

Link to comment
Share on other sites

At this point the differences in the languages are irrelevant. Some designers and developers have gotten very excited over the emergence of HTML5, while others prefer to stick with XHTML based on the familiarities and playing it safe. I was trained on XHTML transitional and that is all I have ever used until I began using HTML5. I use both interchangeably. I can assure you that most of your clients are not concern about this or even care. Is it really going to ruin my day if I have to use <br/> or <br>? I doubt it and I don't really care. I like the freedom of HTML5 and the Outline Algorithm method, but I also like the structured rules of XHTML. other than that I have no complaints.

Link to comment
Share on other sites

I haven't kept up to much... but aren't they finally doing away with those stupid transitional/strict designations with HTML 5? They should.

Yes they are. Actually, you can use <!DOCTYPE html> now regardless if you use HTML 5 or not. All the other stuff are not required to render a page correctly. You don't even need the validation code because W3.org has it where you can select which doctype to use to validate your site.

Link to comment
Share on other sites

XHTML was abandoned in 2006 by W3C. XHTML2 was never going to be released. Instead they jumped on WHATWG (web hypertext application technology group)band wagon. WHATGW are group of developers from Apple, Mozilla and Opera that wanted to enhance the capabilities of HTML4. Most importantly, XHTML2 was not going to be backwards compatible like HTML5 will soon be once browser manufacturers stop BSing. Funny, I was criticized by a group of zealots simply because I advised a new designer to do his class project in html5 instead of xhtml. I still use both, but it makes very little sense to cling to something that will eventually be scraped.

Link to comment
Share on other sites

As far as I know, XHTML does still exist, but it's not for normal web page use, it's for specialist applications as Kyle described in 2006 here:-

http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=2139#18788

 

Item 1.6 of w3.org

http://dev.w3.org/html5/spec/Overview.html#html-vs-xhtml

says The first such concrete syntax is the HTML syntax. This is the format suggested for most authors. It is compatible with most legacy Web browsers. If a document is transmitted with an HTML MIME type, such as text/html, then it will be processed as an HTML document by Web browsers. This specification defines version 5 of the HTML syntax, known as "HTML5".

 

XHTML 2.0 will be for specialist XML based languages like SVG and MathML and inappropriate for normal websites. HTML 5.0 is being developed and XHTML 2.0 will be developed alongside for XML coding. XHTML 1.1 and the future 2.0 will never be processed as XML by IE6 when used properly with content="application/xhtml+xml" (they will show a blank page with errors like incorerect PHP or a lot of rubbish code).

 

HTML 5 and XHTML2 are still not officially released as far as I know, but HTML5 is perfectly usable now for normal websites. There will be a compromise X/HTML 5.0 (note the /) as it will process as HTML when combined with the meta tag including content="text/html" and process as XHTML when combined with the meta tag including content="application/xhtml+xml".

 

You can use the trailing slash in <br /> or just <br> in HTML5 and X/HTML5 and lower case for tags is recommended for both.

 

Frankly, it's a mess and still confusing, but I suggest you use HTML5 doctype with old HTML coding and lower case tags.

Link to comment
Share on other sites

As far as I know, XHTML does still exist, but it's not for normal web page use, it's for specialist applications as Kyle described in 2006 here:-

http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=2139#18788

 

 

What? Development for XHTML2 was and has been abandon for general web use. Of course XHTML is still active for general web use. Don't know where you got that notion from.

Link to comment
Share on other sites

What? Development for XHTML2 was and has been abandon for general web use.

See Below:

 

Abstract

XHTML 2 is a general-purpose markup language designed to represent documents for a wide range of purposes across the World Wide Web. To this end it does not attempt to be all things to all people, supplying every possible markup idiom, but to supply a generally useful set of elements - W3C 16 December 2010

 

This W3C Page does not sound like it was dropped in 2006 as you claim. However the Groups Charter did run out in 2010 leaving XHTML2 incomplete, and may never make it as a standard.

 

Of course XHTML is still active for general web use. Don't know where you got that notion from.

XHTML is an XML language and not HTML, it specifically exists for use with languages such as MathML & SVG. Yes it is still incorrectly used for general web development. It is fed to the browsers as HTML and not XML. If you correctly provide it as XML then IE tries to download it and not show it. MS has no intention of supporting it which in the end makes it of limited use. HTML 5 has not replaced XHTML 1, 1.1 or 2 because they are different languages.

 

W3C Editor's draft excerpt:

 

1.1.2. Backwards compatibility

Because earlier versions of HTML were special-purpose languages, it was necessary to ensure a level of backwards compatibility with new versions so that new documents would still be usable in older browsers. However, thanks to XML and style sheets, such strict element-wise backwards compatibility is no longer necessary, since an XML-based browser, of which at the time of writing means more than 95% of browsers in use, can process new markup languages without having to be updated.

 

 

As a last note, HTML 5 is not a standard nor will be any time soon (next few years). Currently HTML 5 is in "Last call status", this means that it is open for developers comments. Once the Last call period ends it goes back into development until all complaints/comments have been worked out. Then it goes into W3C recommendation where it is placed for adoption as the new standard. It is not expected to become a recommendation until 2014 and will likely not be adopted until 2015 at the earliest. Until then there is the chance to for changes among the smaller specifications so some things you design for could still be dropped. HTML 4.1 and XHTML 1.1 are still the standards. The following is a section from the W3C HTML 5 FAQ.

 

Q. Is HTML5 a standard?

No.

 

Q. When will HTML5 be a standard?

W3C reaffirms its expectation that HTML5 will be a W3C Recommendation in 2014.

 

 

Q. Where is HTML5 in the W3C Standards Process?

On 25 May 2011, HTML5 entered the Last Call phase, which involves broad review of technical requirements and dependencies.

 

After Last Call issues have been addressed, the HTML Working Group expects either to continue to Candidate Recommendation (if there are no substantive changes) or to return to Last Call (if there are). W3C anticipates that there will be changes to this specification as a result of the resolution of Last Call issues.

 

See the HTML Working Group Chairs' timeline for reaching the next transition.

 

 

Q. Is the HTML5 specification feature complete?

No. While the major features are now well-established there remain open issues about some features, particularly related to accessibility. The Working Group will address those issues during Last Call. The HTML Working Group does not anticipate adding major new features.

Link to comment
Share on other sites

Funny, I was criticized by a group of zealots simply because I advised a new designer to do his class project in html5 instead of xhtml. I still use both, but it makes very little sense to cling to something that will eventually be scraped

 

XHTML will not be scrapped, it is meant to be used by XML languages and not standard web sites. As long as Mathematicians use MathML for instance, XHTML will be a standard.

 

You were actually right, although I would suggest HTML 4.1 Strict as HTML 5 is not a standard yet. Your "Zealots" were wrong and clearly do not understand what XHTML is.

 

 

Cheers

 

 

Link to comment
Share on other sites

Of course XHTML is still active for general web use. Don't know where you got that notion from.

 

A lot of websites use XHTML 1.0 with content="text/html" (like this forum) but it's "Tag Soup" (a mixture of HTML and XHTML, look at Wikipedia). XHTML 1.0 was a half-way house when people thought that XHTML would supersede HTML and is in fact incorrectly used but then the people who decide these things decided that HTML using content="text/html" and pure XHTML 1.1 and 2 using content="application/xhtml+xml" would go separate ways.

 

No one could be bothered to go back to HTML 4.01 after changing to XHTML 1.0 but now we should think about using HTML5 (but perhaps use HTML 4.01 Strict as Kyle suggests if HTML5 is a step to far too early, but I've started to use it).

Link to comment
Share on other sites

A lot of websites use XHTML 1.0 with content="text/html" (like this forum) but it's "Tag Soup" (a mixture of HTML and XHTML, look at Wikipedia). XHTML 1.0 was a half-way house when people thought that XHTML would supersede HTML and is in fact incorrectly used but then the people who decide these things decided that HTML using content="text/html" and pure XHTML 1.1 and 2 using content="application/xhtml+xml" would go separate ways.

 

No one could be bothered to go back to HTML 4.01 after changing to XHTML 1.0 but now we should think about using HTML5 (but perhaps use HTML 4.01 Strict as Kyle suggests if HTML5 is a step to far too early, but I've started to use it).

 

So have I, and I'm loving it - until I have to deal with IE. Headaches and Creative pains.

Link to comment
Share on other sites

  • 1 year later...

...i recently started learning about HTML and i am also thinking that HTML is an extension version to HTML and HTML will be outdated like that...

 

Which is an extension of which? HTML and XHTML are two different animals.

 

HTML will go on, is actually with HTML5 and it's eventual listing as the new standard around 2014 and it's growing use already.

 

XHTML is for all intense and purposes apparently going away.

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...