Question

HTML 4.01 / XHTML / Strict / Loose / Transitional? What should I use?

Asked by: grexx

I wonder what HTML format  I should use for a new website I'm going to make. It's meant for a wide public, so should have support for a wide variaty of browsers. I don't necessarily need or want 100% pixel precise rendering over all browsers; everything should be readable, visible, usable as intended. Firefox and IE6 should be very close in design.

- I could simply go for HTML 4.01 transitional, but I would like to start using XHTML, or the strict variant of HTML 4.01. I wonder what's the best to do.
- I've read that XHTML specs are going to change, and that it's not widely supported. But I suppose IE6 and FF do support it, and Opera and Safari as well.
- What variant of XHTML is the best to use and why?
- What happens if I start using divs instead of tables to layout a page? What browsers will get into trouble?
- What's the case with IE5 or IE5.5? I heard that it can be a problem and does things very differently.

Any ideas, input, suggestions are welcome!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-07-12 at 04:53:45ID21488311
Tags

loose

,

strict

,

xhtml

,

html

,

transitional

Topics

Hypertext Markup Language (HTML)

,

Macromedia Homesite

,

Extensible HTML (XHTML)

Participating Experts
7
Points
500
Comments
49

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. XHTML scalable textarea?
    I have the following page that works great to create a scalable textarea. http://www.raibledesigns.com/onpoint/sandbox/textarea.html By scalable, I mean that the textarea always occupies 100% of the <td> it's in. Could be a <div> - I don't have a preference. H...
  2. DIV Height in Firefox XHTML Strict
    For some reason I can set the height of a div with Firefox XHTML Strict. Any one know of a way to combat this? here is my css #Top_menu{ position:relative; width:700px; margin-top:0px; padding-top:10px; padding-bottom:10px; height:38px; }

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: flow79Posted on 2005-07-12 at 05:06:37ID: 14420536

here are my suggestions as one humble web designer to you:

(1) DEFINATELY switch from legacy table-based layouts to div/css.  div/css layouts allow your page to be liquid, and your content/layout are as seperated as they can be (always a good thing).
(2) i would use XHTML.  XHTML is simply HTML that follows the rules of XML (if you open a tag, you must close it, proper tag nesting, etc).  As XHTML 1.1 is expanded upon, browsers will still support XHTML 1.0.  The DOCTYPE to use for this is:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
(3) XHTML is supported by all normal browsers: IE, NN, FF, Opera, Avant, Safari, etc.
(4) IE is definately the hardest browser to code for (because it rarely follow web-standards and such).  However, any div/css design can look good cross-browser, you just need to keep track of any IE-hacks that are neccessary for your layout.  For example:  IE and FF display margin and padding in different ways.  To rectify this, you should never put a width and padding or margin on an element.  You set the width on the container, and padding/margin on child elements.  It takes some getting used to, but is definately workable.

 

by: dorwardPosted on 2005-07-12 at 06:49:12ID: 14421322

- I could simply go for HTML 4.01 transitional, but I would like to start using XHTML, or the strict variant of HTML 4.01. I wonder what's the best to do.

Strict - the "real" HTML 4
Transitional - HTML 4 with legacy stuff that should be done with CSS or JavaScript instead (avoid this)
Loose - the filename of the DTD for Transitional
Frameset - for framesets (avoid)

- I've read that XHTML specs are going to change, and that it's not widely supported. But I suppose IE6 and FF do support it, and Opera and Safari as well.

XHTML 1.0 has Appendix C which (sort of) makes it compatable with HTML (meaing it looks a lot like HTML and you can serve it with a text/html content type). In this case browsers will treat it as malformed HTML and you gain no advantage over HTML 4.01.

XHTML as XHTML is not supported by some major clients - e.g. GoogleBot and Internet Explorer. So its not very useful on the WWW.

For the time being, for the vast majority of uses, switching to XHTML is pointless and just introduces problems.

XHTML 2.0 is a long way off and is pretty much an entirely new markup language. I'm guessing it might be usable on the web by about 2020AD.

- What variant of XHTML is the best to use and why?

XHTML 1.0 Strict (has Appendix C, doesn't have legacy junk), but for the average website HTML 4.01 Strict is a better choice.

- What happens if I start using divs instead of tables to layout a page? What browsers will get into trouble?

Don't use DIVs to layout a page - use CSS to do the layout.  You might apply that to div elements, but the div is the element of last resort - use it only if there isn't an element which better describes the semantics of the data.

What browsers get into trouble depends a great deal on your skill with CSS.

- What's the case with IE5 or IE5.5? I heard that it can be a problem and does things very differently.

IE 5.x has significant bugs when it comes to CSS. You can work round most of them though (given time, Google, and CSS mailing lists). However, they also have a very very small market share - so you might well decide that they are not worth bothering with.

 

by: flow79Posted on 2005-07-12 at 08:14:48ID: 14422263

if you have a server-side scripting language it is fairly simple to overcome IE's lack of support for XHTML.  Your server-side language needs to access your HTTP headers and determine whether or not the browser will support the application/xhtml+xml MIME type.  If it will, then it does so, and if not your script would then present the page as text/html.

a good article on this subject is: http://www.smackthemouse.com/xhtmlxml

 

by: bochgochPosted on 2005-07-12 at 08:18:33ID: 14422293

Just like to add a couple of things;

My personal take on the XHTML debate is use it as your doctype IF you are using XML elsewhere on your site. i.e. undertaking XML / DTD / XSL transformations, handling XML RSS feeds etc.

From the point of view CSS / browsers there's no substitution for testing - make sure you test cross-browser as you develop & address quirks & hacks as you go.

 

by: dorwardPosted on 2005-07-12 at 08:24:09ID: 14422344

http://www.smackthemouse.com/xhtmlxml is not a good article.

Quote:
All we need to do is to test if the accept-header sent by the browser, etc., contains the string "application/xhtml+xml"

So:
Accept: text/html,chickensapplication/xhtml+xml (I accept text/html and some made up MIME type)
and
Accept: text/html;application/xhtml+xml;q=0 (I accept textx/html, but I DO NOT accept application/xhtml+xml)

would both be sent application/xhtml+xml.

And if you are going to serve to some clients as text/html, why not serve to all? Its not like you are getting any of the benefits of client side XML.

If you are undertaking XSL transformation - why transform to XHTML? You can transform to HTML just as easily.

 

by: GrandSchtroumpfPosted on 2005-07-12 at 08:53:31ID: 14422653

dorward is right:
1.  Currently, your best option is strict HTML 4.
2.  Content/presentation separation principle says your html should strictly reflect the structure of your content without any type of reference to layout.  Then you use CSS to do the layout.

 

by: flow79Posted on 2005-07-12 at 09:53:13ID: 14423292

dorward, clearly the method undertaken by the article at smackthemouse.com works.

open that link in both IE and FF and view the source in each.  In IE, you will notice the first line is the DOCTYPE, and there is an included meta tag declaring the content as text/html.  Then view the source in FF.  You will see that now it is loading as an XML document (first line is xml declaration), and the meta tag is not in there.

The method does work, and allows XHTML to be used by compliant browsers(aka FF), and still viewed as text/html in those that don't support XHTML (aka IE, etc.).

 

by: dorwardPosted on 2005-07-12 at 10:55:06ID: 14423939

flow79: Clearly you do not understand the points I made.

Point 1:

The HTTP Request header:
  Accept: text/html;application/xhtml+xml;q=0
says: "I accept text/html but I DO NOT accept application/xhtml+xml".

The code provided at smackthemouse.com will look at that accept header as see "Ah, the string application/xhtml+xml is there, therefore they accept application/xhtml+xml" - which is wrong.

The HTTP Request header:
  Accept: text/html,chickensapplication/xhtml+xml
says: "I accept text/html, and I accept chickensapplication/xhtml+xml".

The code provided at smackthemouse.com will look at that accept header as see "Ah, the string application/xhtml+xml is there, therefore they accept application/xhtml+xml" - which is wrong.


Point 2:

The benefits that XHTML can give you (mixed namespaces) can't be used when the XHTML is served as text/html. So the XHTML that you write can't use the benefits of XHTML if you want to serve it as text/html. So what's the point of serving what is (as far as the browser is concerned) HTML with errors in it?

 

by: A4CPosted on 2005-07-14 at 21:49:27ID: 14447820

I've seen a server side script that will check the q value of the mimetype also, and if the ua doesn't support xhtml, it will get rid of all the /> and other xhtml stuff, so it serves pure xhtml to those who really can support it and pure html to those who can't.

Anyways, my opinion:

XHTML is alright to use, get ready for the future, XHTML 2.0 will be separate from 1.x, so don't worry
That mimetype stuff isn't all that bad, as long as you do it right.
I would use XHTML Strict, I personally use 1.1
DIVs aren't bad either, they are not a last resort, they are a presantaional element, meant for you to mess with them untill you like what you see, like this: http://www.chudosok.info/, a website I made that works great in IE6, FF, Opera, the layout is all DIVs and CSS.
IE is definetely the browser to give you the most trouble, you may have to apply hacks.
As for IE5.x, I haven't messed with it, so I can't say anything about that.

 

by: dorwardPosted on 2005-07-15 at 01:03:04ID: 14448517

>XHTML is alright to use, get ready for the future, XHTML 2.0 will be separate from 1.x, so don't worry

If XHTML 2.0 is going to be seperate from 1.x, then isn't that the future and 1.x is a waste of time?

> That mimetype stuff isn't all that bad, as long as you do it right.

Which, as has been demonstracted, is very hard.

I note that the website you referenced is serving XHTML 1.1 as text/html despite the "SHOULD NOT" having over doing that.

And _still_ if you aren't going to use any of the XHTML features which give it advantages over HTML then what's the point of using it?

> DIVs aren't bad either, they are not a last resort, they are a presantaional element

Divs are a last resort - which doesn't mean document with 20 divs in it is a bad document, just that you should look for an element that is a better fit *first*. Generic elements for everything is almost as bad as using tables for layout - the difference is that instead of haven't wrong semantic information you have NO semantic information. What are screen readers supposed to do? Or search engine indexers? Or browsers which don't support CSS?  So if you have a paragraph - say its a paragraph (Use <p>, not <div>), and if you want empathis say emphasis, not span with a class.

They aren't presentational elements either. They are generic block elements with no semantics and no presentation (other then being blocks) attached to them.

As for chudosok ... using JavaScript instead of links? That's horrible.

 

by: mreuringPosted on 2005-07-15 at 03:25:08ID: 14449237

On the subject of designing in divs: http://www.rikkertkoppes.com/thoughts/smurf-language
It's just as bad as designing in tables. Dorward is right when he states you should design using CSS. Html is only semantic markup to create a logical structure in your data, use css to transform the default layout to what you think is more visually apealing.
Some aditional text that goes well with explainging the use of html, specifically classes (same author): http://www.rikkertkoppes.com/thoughts/class-and-style

On the subject of xhtml 1.1, don't ever use it!! The majority of the market still uses IE, IE is completely incapable of handling xhtml 1.1 because xhtml 1.1 must be sent as text/xml. When you feed it to IE as text/html it no longer renders in strict mode and the css bugs will hit you in the face, hard!

I too would recommend using html 4.01 strict, personally, since a lot of people around me just don't get it, yet, I use transitional a lot, you don't have to use the crappy aditional muck in transitional when you declare, but you can, if you want too, and still render in strict mode, to make your css-styling a little less of a hassle.

My two cents,

  Martin

 

by: grexxPosted on 2005-07-15 at 05:00:41ID: 14449811

My use of <div> would merely be to devide the page in three or four areas: logo, top menu, left side navigation menu, and main content. In the main area can be different elements with different functions, like login form, table data in a list, help text about the page, etc. I still use html-tables to display lists of data with column headers, or two column tables with left side the column name and right side the value.

We use several elements on the page of a website, for instance help text. The help text has a different layout, so I use a <div class="help"> around the help text. Inside that div, I use h1, p, b, whatever I need to structure the data or text. So there I use standard html the way it was meant. I could do <h1 class="help"> and the same for p etc, but that's not really handy. In the CSS I define it like "div.help h1 { color: red; }" etc. The container-div is handy here for margins, backgrounds, padding, etc.

So this way I use divs to layout the page, and I wouldn't know how to do it differently.

 

by: mreuringPosted on 2005-07-15 at 05:31:43ID: 14450021

But, you could for instance set the class="help" on you body instead, because the fact that you're on a help page applies to everything there, even if you only style the content differently and not the menu.

Other than that, what you're doing is more or less the essence of using divs for divisions, so I'd say you're on the right track there. I hope that our differences in opinions about which doctype to use aren't too confusing and wish you the best of luck on making your decision :)

 Martin

 

by: grexxPosted on 2005-07-15 at 05:50:59ID: 14450194

The discussion about doctypes is beginning to make sense, especially the part about the mimetype, and that it's useless to server xhtml as text/html. I think I'll stick with html 4.01 strict. It's quite interesting though, this discussion.

mreuring, what you say about setting the help-class on the body is not an option. The help-text is just an optional element on a page, and therefor it's in a div.

 

by: mreuringPosted on 2005-07-15 at 06:04:58ID: 14450292

I've had this discussion too often to find it interresting anymore :) There's a permanent difference in opinion on the matter, I just think practicallity should be leading, and that would lead to strict and not xHtml, just make sure you validate the html-code and I think the standards fanatics will be quite content.

On a sidenote, for ease of work, you can install an extention in FireFox which will validate using w3c's tiny validator, this will give you imediate feedback when browsing your pages using FireFox. A must have for developers who want to get serious in making validated websites.

concerning the help-class makes a lot of sense setting the class on a surrounding div then :)

 

by: dorwardPosted on 2005-07-15 at 06:07:05ID: 14450313

Word of warning: Tidy isn't a validator, its a lint - and it does make errors in its syntax checking process from time to time.

 

by: A4CPosted on 2005-07-16 at 13:31:27ID: 14459292

> If XHTML 2.0 is going to be seperate from 1.x, then isn't that the future and 1.x is a waste of time?

Well, helped me get used to all the standard complient stuff and throw the quirks off

> Which, as has been demonstracted, is very hard.

True, I'll go search for that premade script you can use

> I note that the website you referenced is serving XHTML 1.1 as text/html despite the "SHOULD NOT" having over doing that.

Well, it's kind of temporary, I'm working 2.1 which will be sent as application/xhtml+xml to those that can handle it and I'll think of something for IE, like text/xml + an xsl hack so that it will display correctly. The point is, it's not the worst thing that ever happened.

> And _still_ if you aren't going to use any of the XHTML features which give it advantages over HTML then what's the point of using it?

I probably will, give me some time. And it's good for learning to do things strict.

> Divs are a last resort - which doesn't mean document with 20 divs in it is a bad document, just that you should look for an element that is a better fit *first*. Generic elements for everything is almost as bad as using tables for layout - the difference is that instead of haven't wrong semantic information you have NO semantic information. What are screen readers supposed to do? Or search engine indexers? Or browsers which don't support CSS?  So if you have a paragraph - say its a paragraph (Use <p>, not <div>), and if you want empathis say emphasis, not span with a class.

Sometimes I will have to stick a few <p>'s in a element, div's are good for that.

> They aren't presentational elements either. They are generic block elements with no semantics and no presentation (other then being blocks) attached to them.

I meant not presentational but for doing pretty stuff, sorry for the wrong word >_<.

> As for chudosok ... using JavaScript instead of links? That's horrible.

It uses ajax, just an experiment I wanted to do, it will be fixed in 2.1

 

by: dorwardPosted on 2005-07-16 at 13:57:54ID: 14459354

> Well, helped me get used to all the standard complient stuff and throw the quirks off

Why wouldn't HTML 4.01 do that?

> I'll think of something for IE, like text/xml + an xsl hack so that it will display correctly.

What about lynx? And GoogleBot?

> I probably will [use XHTML features], give me some time.

Which will break it for all non-XHTML user agents.

> And it's good for learning to do things strict.

So is HTML 4.01 Strict.

> Sometimes I will have to stick a few <p>'s in a element, div's are good for that.

If you need to group the paragraphs together and there is no element with the right semantics ... but then that is the last resort.

 

by: A4CPosted on 2005-07-16 at 15:48:36ID: 14459601

> Why wouldn't HTML 4.01 do that?

Because the browser won't complain as much if you do something wrong, especially on javascript.

> What about lynx? And GoogleBot?

Serve it as text/html to those. I'm probably going to edit that script and make it go accross bots too.

> Which will break it for all non-XHTML user agents.

That's why I'm taking my time.

> If you need to group the paragraphs together and there is no element with the right semantics ... but then that is the last resort.

Well, I guess, but I never considered it that way.

 

by: dorwardPosted on 2005-07-16 at 15:51:57ID: 14459607

> Because the browser won't complain as much if you do something wrong, especially on javascript.

Is this a quirks/standards mode thing? HTML 4.01 Doctypes can trigger standards mode.

If its an XML thing, then that just introduces even more issues - such as having to use namespace aware DOM methods, but since those don't work in HTML mode you end up having to write have your scripts twice.

 

by: A4CPosted on 2005-07-16 at 16:03:14ID: 14459630

It's more about XML, but if you use HMTL 4.01 DTD, the broswer will still let you give it malformed HTML. XML willl not allow it.

 

by: dorwardPosted on 2005-07-16 at 16:08:46ID: 14459641

Ah, do you use innerHTML? I tend to use the DOM functions to build elements, that prevents you from writing non-well-formed code.

 

by: A4CPosted on 2005-07-16 at 16:08:51ID: 14459642

The thing is, I think using XHTML isn't all that bad, I would encourage it, in fact. It will result in better built websites if developers check the validity and accross most popular browsers, espacially the ones who support the xhtml mimetype

 

by: A4CPosted on 2005-07-16 at 16:09:43ID: 14459644

> Ah, do you use innerHTML? I tend to use the DOM functions to build elements, that prevents you from writing non-well-formed code.

It depends, most  of the time I use DOM functions.

 

by: dorwardPosted on 2005-07-16 at 16:13:31ID: 14459652

How will valid XHTML result in better built websites compared to valid HTML?

 

by: A4CPosted on 2005-07-16 at 16:19:16ID: 14459663

How will they be worse?

 

by: dorwardPosted on 2005-07-16 at 16:33:20ID: 14459698

I've mentioned some of these points already, but here goes.

1. Browsers which deal with XHTML as XHTML generally don't do incremental rendering.

2. Some browsers which deal with XHTML as HTML follow the SGML rules and render a ">" character after each tag using XML minimised tag syntax.

3. There is a distact lack of tools for testing conformance to Appendix C of the XHTML specification.

4. To avoid points 2 and 3, you burn server resources converting XHTML to HTML, but using XHTML in the first place gives no benefit to end users.

5. If you serve as XHTML to some user agents and HTML to others, you have to rig your cache control to vary on the accept header - which makes caching proxy servers less useful.

6. XML DTDs don't support SGML exclusions, so validation can't reveal some errors in an XHTML document that would have been picked up in an HTML document.

 

by: A4CPosted on 2005-07-16 at 16:52:33ID: 14459735

My main point is you don't need to discourage XHTML usage, if people have the capability of doing it, then let them. I feel discouraging XHTML usage slows developement of the web down. The reason I asked that question was because I don't want to argue (even though we did a little). I know of XHTML's pitfalls, and all we have to do is inform people of how to avoid them.

 

by: dorwardPosted on 2005-07-16 at 17:00:21ID: 14459748

XHTML 1.0 is a dead end. Not using it isn't going to hold back the web. XHTML 2.0 is going to be pretty much an entirely new language.

Oh, and (7) Since XHTML isn't HTML, the HTML specific bits of CSS (such as little things like class selectors) aren't supposed to apply to it.

 

by: A4CPosted on 2005-07-16 at 17:06:13ID: 14459759

Oh well, it's all really a matter of opinion, so no real use arguing about it. And IE 7 is coming out in the not-too-distant future, so in a few years, when XHTML 2.0 isn't ready yet, we can enjoy the benefits of XHTML 1.x with most browsers supporting it.

 

by: dorwardPosted on 2005-07-16 at 17:09:56ID: 14459769

The benefits of XHTML being of no use whatsoever to the vast majority of authors. Not really a lot of enjoyment there then.

 

by: A4CPosted on 2005-07-16 at 17:15:30ID: 14459781

Huh? You mean right now? Maybe, but I said in a few years, you could proabably use XHTML 1.x freely, when 2.0 won't be ready yet.

 

by: dorwardPosted on 2005-07-16 at 17:18:38ID: 14459786

And the point of using XHTML in a few years time would be what? Mixed namespaces? How many authors have a use for MathML? What's wrong with sticking SVG in an external file?

... and you would still have browsers out there which didn't support it.

 

by: A4CPosted on 2005-07-17 at 00:13:47ID: 14460553

I, for one, am tired of making tag-soup, so XHTML is good for me there, and anyone else who is tired of the tag-soup. BTW, if you want to know what chudosok 2.1 is going to be like, you can check out the beta at http://www.chudosok.info/21 I'm quite sure it's not that horrible.

You can also make your own namespaces and stuff to use, plus plenty exist, so not only MathML users are going to use that feature. And XHTML is a little faster than HTML because XML rendering is easier on the UA. In a few years, the browsers that don't support XHTML will probably be used by >1% of internet users.

Just wondering, but are you like, totally against XHTML 1.x?

 

by: mreuringPosted on 2005-07-17 at 02:24:44ID: 14460871

"Just wondering, but are you like, totally against XHTML 1.x?"
Yes!

There's nothing in xHtml that accually does anything for an author that's usefull. Getting rid of tagsoup? I don't think so, I can use as much tagsoup as I want int xHtml, accually, I can use a whole lot more tagsoup in xHtml 1.1, using those custom namespaces you mentioned.
Want to get rid of as much tagsoup as possible? Start validating your 4.01 strict documents, so that they're accually html 4.01 strict, instead of claiming the title and failing horribly.
Accually, you can validate 4.01 non-strict to get rid of your tag soup too.

I completely agree with dorward, you're only making it harder on your server by trying to serve non-xHtml browsers a different document, oh, and that would be pitfall number one, you'll have to code against at least two documents. To get back to the javascript problems, IE servers xHtml 1.1 as quirks html, introducing some nice javascript incompatibilities as well as CSS-troubles.

xHtml just brings so much more trouble and fixes nothing you couldn't already fix yourself, it's not worth the time to learn, wait for something usefull to come around, like 2.x

 Martin

 

by: A4CPosted on 2005-07-18 at 13:02:58ID: 14469709

Most articles that discourage the use of XHTML say that advanced authors can avoid the pitfalls, but these authors are very few, and those authors are all right with using XHTML, the people who write those articles don't discourage them. Those who want to join these, like me, are more than welcome to do so in my opinion, as long as they know what they're doing. I've studied all the XHTML 1.x stuff thouroghly, and I can get past the quirks of IE and all that with XHTML. Like, for example, IE won't render 1.1 when served as application/xml, you can only serve 1.0 to IE. If someone can handle these issues, let them. XHTML renders faster, BTW, cuz it's xml.

 

by: dorwardPosted on 2005-07-18 at 13:05:40ID: 14469727

XHTML might be parsed faster - but browsers tend not to start rendering it before its all been parsed. That doesn't make much difference until you throw in the time it takes to transfer a document across the Internet. HTML renderers usually do incremental rendering. So while the entire document might be displayed sooner with XHTML, with HTML it seems faster to the user, and the user can start reading it sooner.

 

by: A4CPosted on 2005-07-18 at 13:12:18ID: 14469791

So, what would you say about the people who can actully handle xhtml?

 

by: mreuringPosted on 2005-07-18 at 14:21:25ID: 14470462

As far as I know, the people that can handle xhtml are more rare than those who can get around the pitfalls of using html 4.01 strict. This is mainly because one only needs to validate a strict 4.01 document to make sure the syntax is correct while for using xHtml you have to validate the document (alright, the browsers handles this) and then test it accross the browsers that you're sniffing to serve a different header.

And if the only benefit of xHtml (so far it's the only one I've seen you give us) is a slightly faster rendering, I don't think it's really worth the trouble. So let's talk differences:

html 4.01 strict requires:
- proper validation, needs an external tool which is readily available.
pro's:
- All known browsers support it
- renders in strict mode
- scripts in strict mode
con's:
- Still allows you to serve invalid documents, validation is a seperate process.
- Not the latest technology

xHtml 1.1 requires:
- proper validation, any capable browser will do, or readily available external tools
- different mimetype header to service IE (request header)
- different doctype to service IE or it won't render nor script in strict mode
pro's:
- renders in strict mode
- scripts in strict mode
- can be handled by any xml parser for possible server-side modifications
- enforces valid xhtml structure
con's:
- requires serverside script to sniff browser acceptance
- breaks down when handled improperly

I've tried to be as objective as possible here, and, you should realise this, I've only just last week moved my own site back to html 4.01 strict because of just such a debate as this one...

Let me know if your missing anything in the pro's/con's or dissagree with them.

 Martin

 

by: dorwardPosted on 2005-07-18 at 14:24:59ID: 14470491

html 4.01 strict:
- Not the latest technology

That's not a con. Latest doesn't mean greatest.

xHtml 1.1:
- different mimetype header to service IE (request header)

Using that different mimetype violates the specification
Its not just IE that you have to worry about. Lots of user agents do not support XHTML. Googlebot included.

- enforces valid xhtml structure

No it doesn't. It enforces well-formedness, not validity.

 

by: A4CPosted on 2005-07-19 at 15:44:11ID: 14480235

All right. I agree with most of what you said, but if someone knows how to avoid the pitfalls, then let him. Let's not argue anymore, let's let the person now decide what he wants to use.

 

by: flow79Posted on 2005-07-19 at 15:48:27ID: 14480265

another option would be to code your page in actual XML, and then use XSLT to convert it to HTML/CSS.  that way you get all the abilities of XML, but the layout of HTML/CSS.

 

by: A4CPosted on 2005-07-19 at 15:52:04ID: 14480286

Yes, that's an option, but you have to know what you're doing, since it can be rather complex. If you're an advanced user, you can go ahead.

 

by: Joakim_Posted on 2005-07-28 at 13:03:25ID: 14549486

As doward said -- "XHTML as XHTML is not supported by some major clients - e.g. GoogleBot and Internet Explorer. So its not very useful on the WWW."... Most "XHTML" sites are normally only HTML with a very strict code, served as "text/html" -- not as "application/xhtml+xml", which, as doward says, amongst others, Internet Explorer doesn't support. It is simply only really strict HTML code. But I recommend you to use this strict HTML, so-called "XHTML", code, as it is more widely supported by the browsers, as long as it is "text/html". And you can also proudly put the "Valid XHTML 1.0" button on your site!

 

by: dorwardPosted on 2005-07-28 at 13:08:23ID: 14549543

HTML 4.01 is supported better, since the HTML Compatability Guidelines in Appendix C of the XHTML spec depend on browsers not implementing HTML correctly - and some get it right. Having ">" scattered around the output isn't fun.

And you can stick a Valid HTML 4.01 button on your site if you really want to.

http://www.cs.tut.fi/~jkorpela/html/validation.html#icon

 

by: grexxPosted on 2005-07-28 at 15:05:37ID: 14550574

We have a web application created in JSP. The setup is pretty complicated, and there are many small errors in the HTML code. The way everything is setup, it's difficult to track down the errors. When I posed the question I thought I was going to rebuild the complete application, start from scratch. The plans have changed, and now I'm partially rebuilding the site, using JSTL (JSP Standard Tag Library, an XML language, similar to XSLT) and XML/XSLT. The XSLT has all the HTML code, which keeps it very compact and clean. These JSTL-pages are included in the normal pages, so they are just a part of the page. The rest of the page is old code. In a few months I hope to find the time to convert that as well. But for the moment the code still has errors. So I'll leave it at HTML 4.01 loose for now.

But in the end I will probably choose HTML 4.01 strict. I know it would be possible to serve multiple formats depending on the browser, but that would probably mean creating different CSS stylesheets as well, and then it can get out of hand. The conversion also means that the CSS stylesheets have to be changed, but with the XSLT's it's probably going to be a lot easier to change the HTML to the needs of the layout, so I hope the CSS will be simpler as well.

(Btw, JSTL/XSLT rocks! It's a lot easier than I thought it would be.)

 

by: grexxPosted on 2005-07-28 at 15:12:57ID: 14550630

And I forgot to say: thanks for all your input. Some of the discussion was too much for me, but in the end I got the important parts I think.

 

by: A4CPosted on 2005-07-29 at 16:37:44ID: 14559510

One thing about CSS is I've never seen anyone use different stylesheets for XHTML and another when serving the XHTML as HTML. My sites will render 100% same in XHTML and HTML. So, the CSS shouldn't get in the way, whether or not you use XHTML.

God Bless.

 

by: A4CPosted on 2005-07-29 at 16:42:50ID: 14559544

One more thing, if XHTML 2.0 would only be usable at 2020 as dorward says, why not use XHTML 1.x on 2015, when XHTML 1.x will be thuroughly supported, but XHTML 2.0 won't?

I think the date 2020 is off, but whatever the dates will be, if you put them in the equation above, XHTML 1.x will make sense.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...