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. . .
"No need to test all the browsers", not quite true 🙂
We have started to build for firefox and then fix the IE bugs!
"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 😉
" 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 😉
The last time I checked, I thought VS.NET 2003 didn’t support XHTML.
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.