If I code in strict XHTML will it validate in transitional doctype?


Weird question but I couldn’t find the answer so apologies if it has been answered and I know it might seem like a noob question.

I need to create a website, and I want to develop it with a strict xhtml doctype. However when I am done creating the website, I have to hand it over to another department that wants it as a transitional xhtml doctype.

So I was going to develop everything with a strict xhtml doctype, and then just change the doctype to transitional before handing it off.

My question is, if I go this route will I experience any validation issues?

Thanks in advance :slight_smile:

Probably not since with Strict you have less Elements/Attributes to choose from (to start with).

But if you were going Transitional to Strict then you possibly would have issues, e.g. the evil FONT not being available in Strict, etc. You get the gist…

There will not be any validation issues since the only difference between strict and transitional as far as HTML is concerned is that transitional allows HTML 3.2 tags where strict does not.

It may have an impact on JavaScript attached to the page though as some browsers look for values in different places depending on whether a strict or transitional doctype is used - although the main browser where this is an issue is Internet Explorer and the only version of that browser to support XHTML is IE9 which is still in development.

Awesome thanks for the reply guys :). The whole IE issue still confuses me, every client/firm wants me to code in xhtml but I keep hearing it is not fully supported in IE yet I see alot of websites use it. I guess I need to further research to really know what the negatives are when using an xhtml doctype and my IE visitors.

People who want to write in XHTML generally are the ones who fall for any new buzzword around the office…

Unless you know that no-one using your website will be using IE<=8 (eg it’s an intranet and you only deploy Firefox on your network), you have to serve the document as text/html rather than application/xhtml+xml. And once you’ve served it as text/html, it is HTML, not XHTML, even if you’re using an XHTML doctype and syntax.

But yes, in answer to your original question - if it validates as Strict then it will also validate as Transitional - because Transitional is just like Strict but not as, well, strict. It allows everything the same, and a bit more.

Hmm it seems as though xhtml is widely being used mostly for the strict way it wants you to code…(ie: closing all tags, all lowercase, etc) unless of course you are actually trying to utilize xml.

Would this be why the sitepoint website is xhtml? I wonder if sitepoint has written anywhere why it uses xhtml instead of html as I would be very interested in reading such an article. Especially if they explain why and give in depth reasoning as to what made them go that route.

For those that theme scripts like joomla and wordpress, what doc type do you usually use?

And for those who want to learn more like me, this is an interesting article:

Actually xhtml is hardly being used at all on the web.

Would this be why the sitepoint website is xhtml?

But it isn’t. An xhtml doctype and xhtml style tags doesn’t make it into xhtml. You have to serve it as xhtml too, and nobody does that because IE won’t show it if they do.

I think you’ve hit the nail :smash: right on its head :slight_smile:

I code in xhtml, although I serve the documents as html because of IE etc, because I want my html coding (at least for commercial websites) to be consistent throughout as passing the w3c validator certifies.

others could argue that html strict is better, which I am not convinced it is, but it boils down to personal choice.

Well that’s my confusion, if you aren’t serving it as xhtml then why even use the doctype and why code it as xhtml…Which is why I mentioned that it would be great for the sitepoint gurus to create an article as I am sure this would help alot of people like me from having to go into a padded room… :crazy:

I guess I meant the doctype mainly. Most major/popular websites I know of use this, it is very rare that a website i frequently use doesn’t use xhtml:

lol, nice thank you for the validation that there is still some sanity left in my understanding :drink:

That is the main thrust of the argument pushed by the pro html strict coders.

Personally I don’t see any significant, if any, “technical” advantage of using 1 over the other.

It boils down to personal choice based on which you prefer and what you are used to.

I am still catching up to HTML5, is the coding loose like HTML4 where you can have lower case and unclosed tags or is it strict like XHTML where everything has to be closed, lowercase, etc…

I guess I am asking, if I code in XHTML xtrict or transitional would it be a pain to convert my website to HTM5?

(X)HTML5 allows either HTML or XHTML syntax to be used depending on which you prefer.

That is great news!! Thank you! :cool:

To be honest, I haven’t looked closely at the new elements in HTML5 because it is not fully supported yet in all the major browsers.

Eventually when HTML5 becomes fully supported I would be very surprised, and even more disappointed, if websites coded in HTML or XHTML Strict had to be converted to HTML5 for them to continue working properly. I doubt very much we will have to do that.

The only time you might have to update/convert a (X)HTML4 Strict web page to HTML5 is if you need to add some HTML5 specific feature that you cannot replicate using (X)HTML4.

When HTML5 becomes fully supported then I will look at coding in HTML5

Hopefully I won’t be proven wrong on the above :eek:

hmm, I was under the impression that people already started to code via HTML5 … at least that is what I keep hearing. I guess it would be safe to code in HTML5 but use XHTML syntax then when HTML5 is fully supported you can begin implementing the HTML5 specific features. …

However I don’t even want to know how this is going to affect users pre-IE9 … considering that clients still ask for websites to be compatible for IE7 at minimum.

I just did a google to find which browsers support HTML5 and to what extent.

I found this interesting browser testing website

Pointing 3 of my browsers to that url gave the following scores measuring how well they support HTML5

IE8 - 27/300 (27 out of a max of 300)

FF3.6 - 139/300

Opera10 - 67/300

Now I have no idea how reliable the site’s testing process is but regardless of the actual scores I think it’s fairly safe to assume the above 3 browsers do not fully support HTML5 yet.

I believe, from the blurbs I read elsewhere, that IE9 will be much more HTML5 compatible but I don’t know to what extent.

nice thanks for the link. I guess it is probably safe to just continue using XHTML transitional served as HTML lol. Boy oh Boy, I am not really sure if I will be ready when HTML5 becomes a standard and clients want to code for that yet still have websites render correctly on IE7 :frowning:

I wouldn’t worry about it too much atm.

In that case I would explain to the client that not all their required to be supported browsers support HTML5 features and so give them the opportunity to water down their site specifications if they wish.

If they insist on HTML5 features and to also support non HTML5 browsers then you can just charge them accordingly for the extra work to provide alternative code for non HTML5 browsers.

Yes it will probably mean a little more work for developers, but I prefer to think of it as an opportunity to make a few extra dollars.

Since HTML5 is still only a draft there is still plenty of time for it to change before it becomes a standard. Also judging by the huge percentage of web sites that are yet to finish upgrading to use HTML4 13 years after it became a standard it will probably be several decades before HTML5 starts to become important. After all the browsers can’t fully support it before it becomes a standard and if they do rush in too quick beforehand then we’ll just end up with a repeat of what happened when IE5 tried to support CSS2 before it became a standard which led to the introduction of quirks mode to allow pages that used that abandoned version of the standard to be rendered correctly.

hmm, I was under the impression that people already started to code via HTML5 … at least that is what I keep hearing. I guess it would be safe to code in HTML5 but use XHTML syntax then when HTML5 is fully supported you can begin implementing the HTML5 specific features. …

Here’s a site that, when I sniffed through the code, was as much HTML5 as they could stand: betribes.com I mean, if you look at youtube.com it’s mostly the doctype and they wanted to use <video> (which lets me actually use youtube on my machine as I don’t have Flash but I do have Chrome).

Why SitePoint uses XHTML? Because the X is seXy. There is no other reason. The X is seXy. Similarly, many of the sites using HTML5 think the “5” is sexy. Meh.

I prefer HTML4 Strict BUT I will send it through the validator and tell the validator to pretend it’s XHTML1 Strict. So I write as strict as I would if I were writing XHTML, but don’t use that doctype and don’t use closing slashes (if they’re ignored by the browser, then why do I have them?). Yeah, same could be said for selected=“selected” when the browser only bothers looking at the first “selected”, but again I guess it’s the strictness that’s appealing and /> would invalidate my HTML4 : )