Killersites.com Homepage Welcome Guest  |  Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help



Quick Go »

No member browsing this thread
Thread Status: Active
Thread Type: Sticky Thread
Total posts in this thread: 17
Posts: 17   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 11544 times and has 16 replies Next Thread
Male LSW
Advanced Member
Member's Avatar

USA
Joined: Nov 27, 2003
Post Count: 6287
Status: Offline
Reply to this Post  Reply with Quote 
HTML or XHTML? [updated: 30 July 06]

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".



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 <br/> <meta ...../> <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+xmll.

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 <![CDATA[ ????? ]]>, 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 biggrin here are some handy links on the subject:

----------------------------------------
Gu.aal kwsh� yak'�i it�akw ijeet wugood�k

LSW-WebDesign.com
----------------------------------------
[Edit 4 times, last edit by LSW at Jul 30, 2006 9:59:52 PM]
[Apr 14, 2005 3:26:22 PM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.lsw-webdesign.com [Link] Report threatening or abusive post: please login first  Go to top 
Male shelfimage
Advanced Member
Member's Avatar

USA
Joined: Mar 24, 2005
Post Count: 3000
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

Re-reading replies on the other threads, browsing some of the links above, and other material, I've been able to refine my questions and thoughts. But don't think for a minute I don't have more than a mouthful laughing

My concern centers around the business of web design. Is it practical to code jobs for a XHTML DTD specification or stay with the liberal HTML 4.01?

I define practical as working smarter not harder, i.e., effeciency, portability (ease of other designers to maintain the initial work), its shelf-life, getting the most out of a project and my time.

Give me a .PSD from a graphic designer, and I'll cut it up, make a few modifications to the html, and have a compliant HTML 4.01 Transitional website in less time than XHTML 1.0 Strict. And, I'll do so employing "Best Practices" like lists for menus (when possible), content separated from style, clean code, SEO friendly, incorporates usability and accessibility (as much as possible).

As Admin, LSW and other resources all say:
There is no real advantage to using XHTML today. If you serve XHTML as HTML and not as XML you also loose whatever advantages you would normally have had!

But, wait. I have this urge to move forward. To learn more and put to practice what I've learned. Challenges.

I don't agree with the 2nd sentence below:
So HTML is fine and is really the logical choice for web design. Just keep it as XHTML compliant as possible so when you switch one day you have the correct habits.

Here's an example why I don't: This page is XHTML 1.0 Strict and here is the same page only using an HTML 4.01 Transitional DTD. They render the same in the UA's I tested.

But, when it comes to validation the XHTML passes while the version w/ the HTML 4.01 loose DTD fails horribly. So that makes me think that the UA is just serving up tag soup when it gets the HTML version, right? Because, sending a browser XHTML with a DTD of HTML 4.01 Trans is sending language that is semantically incorrect. It's not native. So, I wouldn't want to code XHTML in HTML 4.01 any more than I would want to code HTML 4.01 in XHTML 1.0 Strict.


From an article in LSW's links above:
HTML 4.01 contains everything that XHTML 1.0 contains, so there is little reason to use XHTML in the real world.

And, as posted in another thread and confirmed on the Internet, XHTML seems to be a bit of hype and a popular bandwagon - indeed.

Consider that most XHTML is served as text/html and not as a XML-related media types (application/xml, application/xhtml+xml). In other words, not containing any XML Events or a document named file.xml, for example.

After re-reading the replies in Mini HTML video tutorial now online and other material, I continued on. It's incredible (not suprising) that IE doesn't properly support file.xml (or application/xhtml+xml).

Question: Did someone report that IE7 will support XML-related media types or not?

For fun I renamed a compliant XHTML 1.0 Strict page to index.xml. Mozilla shows it as a web page. IE shows the code or DOM Tree. Experiment for yourself: index.php (html with php includes) vs. index.xml (view in a mozilla based browser and IE). More on this later.

In another renaming experiment, an index.html that validates XHTML 1.0 Strict lost it's main navigation when served as an index.xml. The navigation is DHTML (which I think is DOM b/c it is a combination of html, js, and css) that is called from a <script type="text/javascript" src="the-script.js"></script> in the head and another in the body.

I saw examples of Content Negotation (which is supposed to prevent IE from rendering the DOM tree by serving it text/html instead). One involved a perl script and another was found at w3c that seemed easier to use: http://www.w3.org/MarkUp/2004/xhtml-faq#browsers


Mime types are configured at the server level. Common extensions followed by their mime type:
extension ||||| mime type
xhtml xht ||||| application/xhtml+xml
xml xsl ||||| application/xml
svg ||||| image/svg+xml
css ||||| text/css
htm shtml ||||| text/html html
txt |||||| text/plain asc


Question: Mime type is decided by the server. Can it be manipulated here as well: <meta http-equiv="Content-type" content="text/html;charset=utf-8" />?



/* =============== */
So, now I move on to see what the Ivory Tower nerds (The W3C) say on the subject of HTML and XHTML and find some interesting snippets from http://www.w3.org/MarkUp/

- wink
----------------------------------------
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
Save the developers<!>
Maine Webworks
----------------------------------------
[Edit 1 times, last edit by shelfimage at Nov 1, 2005 1:23:03 AM]
[Nov 1, 2005 1:15:15 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.MaineWebworks.com    mainewebworks    mainewebworks [Link] Report threatening or abusive post: please login first  Go to top 
Male shelfimage
Advanced Member
Member's Avatar

USA
Joined: Mar 24, 2005
Post Count: 3000
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

Mission of the HTML Working Group
The mission of the HTML Working Group (members only) |The "Ivory Tower", right? Or maybe the Soup Nazis | is to develop the next generation of HTML as a suite of XML tag sets with a clean migration path from HTML 4.
So they started the HYPE. ha ha.

Some of the expected benefits include: reduced authoring costs, an improved match to database & workflow applications, a modular solution to the increasingly disparate capabilities of browsers, and the ability to cleanly integrate HTML with other XML applications.

Ok, but as I continued reading, this is only truely possible with XHTML 1.1, MathML 1.01, MathML 2.0, XHTML2 and etc.


Here's what the W3C recommends based on their descriptions of XHTML 1.0 flavors:

XHTML 1.0 Strict - Use this when you want really clean structural mark-up, free of any markup associated with layout. Use this together with W3C's Cascading Style Sheet language (CSS) to get the font, color, and layout effects you want.

And, this can be done with 4.01 HTML based their own admissiosn. From the W3C: The XHTML 1.0 spec relies on HTML 4.01 for the meanings of XHTML elements and attributes.

And this:

We could also take advantage of the redesign to clean up some of the more untidy parts of HTML, and add some new needed functionality, like better forms. I tried to find monumental changes and couldn't. I'll admit that I didn't dig very deeply.

And from the FAQ's:
What are the advantages of using XHTML rather than HTML?
If your document is just pure XHTML 1.0 (not including other markup languages) then you will not yet notice much difference.

Ok then what about...
XHTML 1.0 Transitional - Many people writing Web pages for the general public to access might want to use this flavor of XHTML 1.0. The idea is to take advantage of XHTML features including style sheets but nonetheless to make small adjustments to your markup for the benefit of those viewing your pages with older browsers which can't understand style sheets. These include using the body element with bgcolor, text and link attributes.

Right - so why bother with XHTML 1.0 Transitional at all!!!? 4.01 supports stylesheets. I have two 1.0 strict sites that I changed the DTD only to 4.01 Transitional and nothing broke. One is a CSS-P driven site with ID's, etc, the other is a hybrid table design heavy with CSS.

All of my pages are for the "General Public." Most websites on the Internet are. Intranet is maybe the exception because the UA and workstation environment can be controlled.




Here's more to the mystery of HTML or XHTML?


The first step was to reformulate HTML 4 in XML, resulting in XHTML 1.0.
By following the HTML Compatibility Guidelines set forth in Appendix C of the XHTML 1.0 specification, XHTML 1.0 documents could be compatible with existing HTML user agents.

Now it sounds like serving up a XHTML 1.0 Strict (or Transitional) page as text/html is acceptable and not Tag-Soup after all (or at least it isn't supposed to be. It probably depends on the the UA).

And there's XHTML Basic that apparently is somewhere between 1.0 and 1.1 that supports some XHTML Modules.


XHTML 1.1 - Module-based XHTML
The purpose of this document type is to serve as the basis for future extended XHTML 'family' document types, and to provide a consistent, forward-looking document type cleanly separated from the deprecated, legacy functionality of HTML 4 that was brought forward into the XHTML 1.0 document types.

This document type is essentially a reformulation of XHTML 1.0 Strict using XHTML Modules.

Now it becomes a must to use XML related media types and practical for XML events in XHTML or XML only data files. More on this below.


Why is it allowed to send XHTML 1.0 documents as text/html?

XHTML 1.0 was carefully designed so that with care it would also work on legacy HTML user agents as well. If you follow some simple guidelines, you can get many XHTML 1.0 documents to work in legacy browsers. However, legacy browsers only understand the media type text/html, so you have to use that media type if you send XHTML 1.0 documents to them. But be well aware, sending XHTML documents to browsers as text/html means that those browsers see the documents as HTML documents, not XHTML documents.

Ok, so what does this mean?

IMHO, it means to go ahead and use 1.0 for everyday use. I believe that W3C refers to legacy browsers as any UA that isn't 100% standards compliant as far as they are concerned. So, that is probably all of them. Even Opera and Firefox display differences in standards. And what about cells, pdas, etc.

But if you're gonna do it - do it Strict. And validate it with every change.

thinking hmm, me starts to see why LSW so often advocates for validation. Most important here in XHTML worlds.

If you're using XML events in your XHTML, it would be wise to use 1.1 or newer with Content Negotiation to prevent IE from puking.

But wait, that means the damn stuff won't even work in IE because you'd be serving it text/html and it won't parse the XML content correctly. Or is this incorrect?

As I read at http://www.hixie.ch/advocacy/xhtml point IE at this site http://www.mozillaquestquest.com/ and then view it in Firefox or another mozilla based browser. Now you see it - now you don't. laughing

Mozilla based browsers will do it b/c they'll negotiate the application/xhtml+xml or application/xml and be happy.



/* ================ */

So, for me, I still struggle with the HTML vs XHTML question. But at this point I've ruled out the following from my toolbox :

HTML 4.01 STRICT => It's crap IMHO - never did use it.

XHTML 1.0 TRANSITIONAL => Why bother when I can use HTML 4.01 TRANSITIONAL and it's a dangerous XHMTL?

XHTML 1.1 and beyond => I'm not sure what to do with it yet.
Some of my favorite attributes are gone like name in the <a> tag and then there's DOM; and I'm not sure if I'll have XML Event needs.

-
----------------------------------------
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
Save the developers<!>
Maine Webworks
----------------------------------------
[Edit 3 times, last edit by shelfimage at Nov 1, 2005 2:02:08 AM]
[Nov 1, 2005 1:23:44 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.MaineWebworks.com    mainewebworks    mainewebworks [Link] Report threatening or abusive post: please login first  Go to top 
Male LSW
Advanced Member
Member's Avatar

USA
Joined: Nov 27, 2003
Post Count: 6287
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

... and have a compliant HTML 4.01 Transitional website in less time than XHTML 1.0 Strict.
But I suspect only because you are not used to coding with it. Iwill code faster XHTML Strict because I now know what I am doing and HTML Strict slower as I have to remove all the / that I add automatically. Strict is no slower than transitional once you are used to it.

Here's an example why I don't: This page is XHTML 1.0 Strict and here is the same page only using an HTML 4.01 Transitional DTD. They render the same in the UA's I tested.

But, when it comes to validation the XHTML passes while the version w/ the HTML 4.01 loose DTD fails horribly. So that makes me think that the UA is just serving up tag soup when it gets the HTML version, right? Because, sending a browser XHTML with a DTD of HTML 4.01 Trans is sending language that is semantically incorrect. It's not native. So, I wouldn't want to code XHTML in HTML 4.01 any more than I would want to code HTML 4.01 in XHTML 1.0 Strict.
Not quite sure I follow you here. But my point in your quote is that HTML and XHTML are very similar, mostly the only difference is the backslash /, that you can not use in HTML. HTML can be written with or without "" on attributes, large or small case tags. So you can and should write HTML as close to XHTML as possible... minus of course the / on empty elements so that you are used to it later.

Question: Did someone report that IE7 will support XML-related media types or not?
Yes, it was originally suggested that it would and was on everyones wish list but this is taken from the IEBlog :
I?ve also been reading comments for some time in the IEBlog asking for support for the ?application/xml+xhtml? MIME type in IE. I should say that IE7 will not add support for this MIME type ? we will, of course, continue to read XHTML when served as ?text/html?, presuming it follows the HTML compatibility recommendations. - Chris Wilson


For fun I renamed a compliant XHTML 1.0 Strict page to index.xml. Mozilla shows it as a web page. IE shows the code or DOM Tree. Experiment for yourself: index.php (html with php includes) vs. index.xml (view in a mozilla based browser and IE). More on this later.
Try renaming it to index.xhtml and see what happens wink, also see Gez Lemon's MIME Type Tests.

I saw examples of Content Negotation (which is supposed to prevent IE from rendering the DOM tree by serving it text/html instead). One involved a perl script and another was found at w3c that seemed easier to use: http://www.w3.org/MarkUp/2004/xhtml-faq#browsers
I use Tommy Olsson's Content negotiation , PHP based.

Question: Mime type is decided by the server. Can it be manipulated here as well: <meta http-equiv="Content-type" content="text/html;charset=utf-8" />?
No. By the time the browser reads the meta tags the site has already been deleivered as HTML or XML. That meta tag is of no real use. The only thing that would react to it is when the web site is on a harddrive and therefor no mime type is available. You can serve web sites without it at all and the only bitch you will hear is from validators complaigning they do ot know what character set is being used. NOTE: XHTML is best always served as UTF-8 or 16.

Now it sounds like serving up a XHTML 1.0 Strict (or Transitional) page as text/html is acceptable and not Tag-Soup after all (or at least it isn't supposed to be. It probably depends on the the UA).
Yes, exactly. I can be sent as text/html and that is what most of them do. However as XHTML is should be sent as application/xhtml+xml. That is what I stated as well in the video thread. Yes you can serve it as "tag soup" and that is what it is, but you should serve it properly.

IMHO, it means to go ahead and use 1.0 for everyday use. I believe that W3C refers to legacy browsers as any UA that isn't 100% standards compliant as far as they are concerned.
In this case it is generally felt that legacy here means those browsers that do not support application/xhtml+xml - so IE. What they are saying is what I said before. You can use XHTML and serve your XHTML as text/html if it meets appendix C, but you loose the advantgaes of using XHTML that we (one day will) have.

If you're using XML events in your XHTML, it would be wise to use 1.1 or newer with Content Negotiation to prevent IE from puking.

But wait, that means the damn stuff won't even work in IE because you'd be serving it text/html and it won't parse the XML content correctly. Or is this incorrect?
My opinion, yes you are correct, but that gets deep into XML. Besides at this time as you state above not even Opera and Firefox really support SVG yet and MathML is a specific languagefor scientific use. So yes serving as HTML will block the SVG/MathML... but they are not widely supported anyways so just use HTML. Yes Validation is essential, because one small mistake in XHTML/XML will stop page loading and your user will see a blank page with maybe a cryptic error message.

I would disagree that HTML Strict is crap - it is how HTML was meant to be written. Transitional is just a cheat sheet to allow you to keep por habits. But that is a matter fo persoanl opinion and Stef does have solid argiemets against Strict. I however use it as a matter of pride and it has taught me alot.

XHTML Strict should be used because the others no longer exist as of XHTML 1.1. But XHTML 1.1 is handicapped by the lack of support from IE and as long as SVG and MathML are not fully supported it is rather useless, as well as XHTML 2.0 when released.

I warned you that getting into the HTML vs. XHTML arguement is a stickyWicket. biggrin
----------------------------------------
Gu.aal kwsh� yak'�i it�akw ijeet wugood�k

LSW-WebDesign.com
[Nov 1, 2005 3:30:45 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.lsw-webdesign.com [Link] Report threatening or abusive post: please login first  Go to top 
Male admin
Advanced Member
Member's Avatar


Joined: Jun 14, 2003
Post Count: 2923
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

Good thread boys!

applause
----------------------------------------
Stefan Mischook

Video Tutorial Store | Web Templates
[Nov 1, 2005 8:32:46 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.killersites.com [Link] Report threatening or abusive post: please login first  Go to top 
Male shelfimage
Advanced Member
Member's Avatar

USA
Joined: Mar 24, 2005
Post Count: 3000
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?


I warned you that getting into the HTML vs. XHTML arguement is a stickyWicket.
laughing
Yes.

"Crap" was a bit harsh. I really never did use it and by the time I had enough sense to grasp the importance of writing clean code, I never knew about the w3c and such.

A couple of yrs ago, I concluded that attributes written in uppercase or mixed case and not in quotes looked messy and unprofessional. And, if I was to go P/T and eventually F/T my code should at least look good.

So, I started becoming compliant without realizing it. It was only about 1.5 yrs ago that I began to dive into standards and css and such. And then only since May of this year that I decided to take it the next step - XHTML. (Geez - Thanks! wink beat up )

I think my big concern is if another designer doesn't comply with the DTD and messes up my work. Or a copy editor changes text in the template and doesn't close the tags. What will happen? Probably not too much I guess. Worse case I change the DTD to HTML 4.01 Transitional.

-

Not quite sure I follow you here. But my point in your quote is that HTML and XHTML are very similar, mostly the only difference is the backslash /, that you can not use in HTML. HTML can be written with or without "" on attributes, large or small case tags. So you can and should write HTML as close to XHTML as possible... minus of course the / on empty elements so that you are used to it later.

I meant that the page as written for XHTML 1.0 Strict doesn't validate with the DTD of HTML 4.01. And it is mostly because of the empty elements closed like " />" that. So if you mean as close as XHTML as possible without breaking HTML 4.01 rules than I understand. Otherwise, wouldn't it send IE into quirks mode - tag soup?

It sounds more and more like XHTML 1.0 flavors don't need to be sent text/xml as the spec would lead one to believe. Only XHTML Basic, 1.1, and beyond. Unless you can use XML events in 1.0 - which I'm not sure of yet. Still figuring this out.
-
----------------------------------------
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
Save the developers<!>
Maine Webworks
----------------------------------------
[Edit 1 times, last edit by shelfimage at Nov 1, 2005 10:29:51 AM]
[Nov 1, 2005 10:21:19 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.MaineWebworks.com    mainewebworks    mainewebworks [Link] Report threatening or abusive post: please login first  Go to top 
Female Thelma
Advanced Member
Member's Avatar

Texas, USA
Joined: Dec 8, 2003
Post Count: 3020
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

Ok - I'm confused again, but what else is new???

For a while now, I've proudly been starting my pages like this:
<!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" xml:lang="en">

and I validate, and I cheer when I have no errors. And I learned it all here.

I don't have time to read through all the links, but I checked some, it it appears, that yes indeed, I had no business using XHTML. So, while I'm making some changes to a page I'm working in, I might as well make my wrong right and change. I quickly found the proper HTML stict doctype, but I wasn't clear what if anythign I had to add to my <html> tag - a quick look at W3S didn't help - so I peeked at the source code of the great masters and what do I find? More cause for more confusion.

LSW's, Dawg's, and DavidMead's own pages all are XTHML...... only killersites itself is HTML but is missing the path to W3 on most pages.

Question to the three of you - is XHTML still there because you have not had time to fix it since you realized the difference or is there something on those sites that require it?

And html validator does not seem to like the <.......bla bla" /> iin the meta tags...... is that an expetion to the rule of writing HTML as XHTML?
----------------------------------------
...
[Dec 2, 2005 6:04:56 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.aandbwebdesign.com [Link] Report threatening or abusive post: please login first  Go to top 
Male LSW
Advanced Member
Member's Avatar

USA
Joined: Nov 27, 2003
Post Count: 6287
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

No biggy luv, it sent me for a spin too when I discovered the difference.

You are not wrong using XHTML. It is a legal viable standard. The problem is most people think that XHTML is Better than HTML or more modern or replaced HTML. Wrong on all counts. HTML 4.1 and XHTML 1.0 were released the same month.

HTML is sill a standard and is the latest version. It is meant to create web pages.

XHTML is a language based on XML but formatted to look and work like HTML. You cannot really build a page with XML as it is more a database language for describing data. So XHTML was creaed to work like HTML to create paes using what is a variation of XML (but looks like HTML).

The real difference? HTML uses HTML rules based on the old SGML. XHTML uses XML rules.

HTML can uses large case letters, XHTML can not - all tags, attributes and class, ID names must be small case.

HTML can use or not use "" on attributes, XHTML can not - it must have "".

HTML can have open tags like < img src=""> or <br>, XHTML can not - all tags must be closed < img src=""/> or <br/>.

HTML comments would use <!-- SGML Style (standardized general markup language) --> comments, XHTML wold have to use XML style comments or script language style comments like PHP. The typical comment form could be used but I often see mine showing as text, so I choose to use PHP instead as my pages are mostly PHP based, otherwise you could use CDATA
<![CDATA["whatever your comment is".]]>


However you can and should write HTML just like you would XHTML for good habits, so small case, "" on attributes... but you cannot close empty tags in HTML.

Again XHTML is not wrong. It is really to be used when you are using a XML based language like SVG or MathML. But that is not the only time to use it. It is really simply a matter fo choice, I have been using XHTML for years so decided to stay with it. However I serve it as it should be. This is tricky because XHTML served correctly is not supported by IE, so I have to use PHP content necotiation to serve XHTML to Firefox and Co and HTML to IE.

For me it is a matter fo pride and not wanting to change my habits.But my sites are all straight forward with no XML languages so yes, I could just as easily serve HTML, I just choose not to... and I know why. The problem comes when people code XHTML and think they are serving XHTML when they are really serving HTML and do not know it.

So I suggest beginners stick with HTML. Anyone wishing to use XHTML should do so if they wish... but do so correctly. That means you should code Strict as that is all that is available when you move to XHTML 1.1 or 2.0. You should serve it as application/xhtml+xml as it was meant to be, but you can serve it as text/html... if you understand Appendic C and meet it, and choose toserve tag soup. XHTML 1.1 % 2.0 require you to serve application/xhtml+xml. Get used to using content negotiation to serve IE HTML until they fix it.

Lastly be warned, when you make a error in HTML the page will show but with problems. When you work with XML, hence XHTML served as XML... the browser will stop at the first error and just show a white page with that one error rendering your site useless... so you have to be on your toes and test often.

One final note: XHTML is not required for using XML, you can embed a XML database in HTML. XHTML is requires when you wish to use XML based languages like SVG and MathML
----------------------------------------
Gu.aal kwsh� yak'�i it�akw ijeet wugood�k

LSW-WebDesign.com
[Dec 2, 2005 8:12:59 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.lsw-webdesign.com [Link] Report threatening or abusive post: please login first  Go to top 
Male admin
Advanced Member
Member's Avatar


Joined: Jun 14, 2003
Post Count: 2923
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

Funny, I was just writing a quick little article about all this ... concluding that you should use HTML and not XHTML today.

The key to this whole thing is that XHTML documents are not supported in IE 6 and 7 (and other browsers,) which results in the 'tag soup' scenario ... so their is no benefit to using XHTML.

So with no benefits and several drawbacks, why are many web standards zealots pushing the use of XHTML?

Answer: many web standards zealots are clearly not experienced developers - and I'm talking about many big names.

Proof is found in 'the culture of hackery' that people like Zeldman and Myers have helped to create. These guys promoted this horribly flawed practice (that any junior programmer would question) of using CSS hacks (it's in their books) and now everyone who followed their 'good advice', will have to update their pages when IE 7 comes out ... shedding light on the forward compatibility myth.

devilish

@LSW:

"so I have to use PHP content negotiation to serve XHTML to Firefox and Co and HTML to IE."

I understand pride, but why create extra work for yourself for no real benefit?

Also, when creating dependencies in your web sites (PHP script to parse for browsers,) you are making your websites more brittle ... easier to break.

Remember the basic engineering principle: KISS


My new nickname: The Web Design Heretic
----------------------------------------
Stefan Mischook

Video Tutorial Store | Web Templates
----------------------------------------
[Edit 3 times, last edit by admin at Dec 2, 2005 10:01:14 AM]
[Dec 2, 2005 9:52:36 AM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.killersites.com [Link] Report threatening or abusive post: please login first  Go to top 
Male LSW
Advanced Member
Member's Avatar

USA
Joined: Nov 27, 2003
Post Count: 6287
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML or XHTML?

Pride, because I am a web developer, because I know what I am doing, because I am a standards Zelot, take your choice... but I know what I am doing. my web site is PHP anyways so the extra content negotiation is no biggy.

When I do sites for customers I am now doing HTML rather than XHTML. But my sites will remain XHTML to keep me on my toes.
----------------------------------------
Gu.aal kwsh� yak'�i it�akw ijeet wugood�k

LSW-WebDesign.com
[Dec 2, 2005 4:00:05 PM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.lsw-webdesign.com [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 17   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread