Jeffrey Palermo (.com)

Sponsors

The Lounge

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Use XHTML for your web applications, please! - level 100

I realize that a lot of web applications are targeted for IE, and it may be an intranet application.  Even so, it pays to put the line:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Adding this will save you so much grief later on.   First, your CSS will actually cascade down to child elements, so you can have a very clean stylesheet.  Second, you know that your site will render properly in all browsers.  No need to test all the browsers.  By making your pages XHTML, you are adhering to the standard, so that's all you need to worry about. 

The alternative is to muck up your stylesheet with duplicate declarations and the same css class on nested elements.  Then, when the site looks good, just open it in another standards-based browser and cry.

Many people don't know that if you fail to put a doctype at the top of a page, IE will interpret it as HTML4.0.  If you want HTML4.0, then at least put the doctype there:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
Even then, the other browsers (that default to XHTML) will see the doctype and interpret it as HTML4.

 

I wonder how many web application developers out there have never read the standards docs for xhtml or css. . .


Posted 02-20-2005 3:21 AM by Jeffrey Palermo

[Advertisement]

Comments

Gareth wrote re: User XHTML for your web applications, please! - level 100
on 02-19-2005 8:44 PM
"No need to test all the browsers", not quite true :)

We have started to build for firefox and then fix the IE bugs!
Thomas Bandt wrote re: User XHTML for your web applications, please! - level 100
on 02-19-2005 9:01 PM
"No need to test all the browsers", not at all true.

For example Firefox and IE act different relating to rendering spacings defined in the style sheet.

All things considered it is how Gareth writes, you have tu do at first all for firefox or opera, and then correct the result for the IE.

Regards from Nuremberg, Germany ;-)
Eric Newton wrote re: User XHTML for your web applications, please! - level 100
on 02-20-2005 11:01 AM
" wonder how many web application developers out there have never read the standards docs for xhtml or css. . . "

I haven't and I even know why they're there. ...Vs.Net template change ;-)
Jeffrey Palermo wrote re: Use XHTML for your web applications, please! - level 100
on 05-19-2005 9:30 AM
The last time I checked, I thought VS.NET 2003 didn't support XHTML.
Jeffrey Palermo wrote re: Use XHTML for your web applications, please! - level 100
on 05-19-2005 10:30 AM
Guy,
You are correct, and that is being fixed with VS 2005, but most of the markup is still generated by us, and I have the decision of what DOCTYPE to use.
Jeffrey Palermo wrote How to ensure your web sites are valid Html (or XHtml) - level 300
on 07-29-2005 11:45 AM
I originally was going to label this post level 200, but given how few people know about Html standards,...