Should a production site use HTML5 or XHTML1 Strict? - html

I'm designing a small buiness's website, and I'm windering if I should use HTML5 or XHTML1. I know that HTML5 is more advanced, but it is still a changing spec, while XHTML1 is finalized, so there won't be any compatibility issues in the future. Which one should I use?

HTML 4.01 Strict is the best toy to play with. HTML 5 is not ready, and while it doesn't hurt to include some of its features to enhance your site, where they are supported in some browsers and don't cause others to fall over, it isn't worth investing too much time and effort when the spec could still change significantly.
Unless you know that no-one wanting to visit your site will be using any form of Internet Explorer (up to and including IE8), there's no point in worrying about XHTML. You can only serve it as XHTML, so you don't get any of the advantages of the X, you just end up having to jump through more hoops and run with messy code to achieve the same outcome.

There is no big difference, html5 doctype (<!doctype html>) works correctly in all browsers and corresponds to transitional mode in old browsers. If you wonder should you use new semantic tags from html5 than I can say that there is a simple trick to make them works fine in all browsers.

Related

Technical reasons for using HTML5 doctype, instead of 4.01 strict

I'm working on a new website, and I want to support as many old browsers and operating systems as possible, as easily as possible. From what I've been reading, I know I'm better off avoiding quirks mode, so I need to decide on the best doctype. And everyone seems to be recommending the HTML5 version:
<!DOCTYPE html>
But according to this website, that also recommends the HTML5 version:
https://hsivonen.fi/doctype/, that doctype will trigger quirks mode in Netscape 6, and maybe in Konqueror 3.2. But this one:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
won't trigger quirks mode in any browser listed on that website.
So my question is, is there any reason why I shouldn't use the 2nd doctype? I know those are really old browsers I'm concerned about, but I've seen recent statistics saying Netscape 6 is still in use, at least in Russia. And where I live, I still see a lot of people using Windows XP. So while I don't want to spend a lot of time supporting obsolete browsers, I'm wondering if there are any disadvantages to using the 2nd one, other than it's longer and looks complicated.
edit: All the answers and comments posted so far, have been really helpful. Now I'm starting to see that it's a tradeoff between:
1) being semantically correct, and
2) putting more of the very old browsers into standards mode, instead of quirks mode
In most cases #1 is probably more important, since not many people use those really old browsers. And if they do, they're probably used to things looking a little off. But if you're more concerned about things looking better in really old browsers, then #2 could be a better choice.
Anyway, I'll wait a while to see if anyone adds any more answers or comments. Thanks!
edit 2: All 3 answers were helpful. And 2 of them helped me understand specifically what I needed, so I selected one of those. But I would have selected both, if I could have.
The only reason I can think of is that if you want or need to use HTML 5 in the future you'll be able to with more ease already doing everything in HTML 5.
And browsers should have no problem dealing with the fact that it's strict 4.01 and will display it just as if it didn't have the doctype anyways.
Basically from a "what the page looks like" point of view your strict 4.01 will look the same in a html 5 doctype as it will in a strict.
Having said that, it does depend on your HTML there are certain times that you'll need to do it but chances are it shouldn't matter
Really good link for further info on doctype declarations:
http://www.htmlgoodies.com/html5/markup/the-doctype-tag-and-its-effect-on-page-rendering.html#fbid=JCm-bKCUNc6
There are several reasons:
Old browsers(those that doesnt support html5) wont be forever, one day the will be gone but those browsers that can support html5 will take long time in order to be a "old browser". So try to take advantages of all those new html5 feactures.
HTML5 has some new tags that are better for S.E.O
HTML5 Introduced new video codecs that will improve the audio and video experience.
HTML5 introduced a really drag and drop feature!
So what I suggest you is to use html5 and try do your best to make "old browsers" run your html5 website.
I would just use the , but not use any HTML 5 specific features, I think that would work nicely. Older browsers try to render the page as good as they can. In any case, if you DO want to use HTML 5 features, you can always see if they are available in your javascript code or use a framework such as modernizr.
According to me main reason is that :
<!DOCTYPE html>
Html5 : Supports header, footer and section tag. And this tags are easily readable to google for "Search Engine Optimization". So, google takes it as important content on our page.
And for "4.01 strict" :
These header, footer and section tags are not supported.

HTML 4.01 vs. XHTML 1.0

Which one is better and why for a new project? I'm assuming all will be strict, as I see no reason to go transitional for a new project.
HTML 4.01 vs. XHTML 1.0
The problem with both of these is that they have been effectively rendered obsolete by HTML5.
In fact, you're really asking the wrong question. HTML4, XHTML and HTML5 are basically the same language, but with certain features missing from one to the other.
The really important thing (and probably the reason why you may feel like you have to choose) is that it is important to specify a doctype, in order to prevent older browsers dropping into quirks mode. At the point where you find you have to specify a doctype, you also find yourself presented with a choice of which one to use, and the syntax makes it look like you have to get it absolutely perfect or it'll all stop working.
But you don't need to worry about that. The following doctype is sufficient to make all current browsers (including IE6) run in standards mode:
<!DOCTYPE html>
Simple, eh? No need to worry about HTML4 vs XHTML at all.
The thing is, the above doctype also happens to be the doctype for HTML5. It was chosen deliberately because it works in existing browsers.
If you need to support older browsers, you don't have to use HTML5's flashy new features, but using this doctype means that you will be ready to use them when the time comes. And if you do feel like dipping your toe in the water, a lot of the new features will degrade gracefully in older browsers, so you can use them; they may not work in IE6, but they won't break the browser either.
I hope that helps.
If you are using an XML toolchain, and it can handle HTML compatibility (which is needed for IE 6-8) then you might consider going with XHTML, otherwise go with HTML.
If any of the features added in HTML 5 are going to be useful to you, and browser support for those features is mature enough then go with (X)HTML 5, otherwise go with HTML 4.01 / XHTML 1.0 as they have more mature QA tools.
If it's for a new project, start reading up on HTML5. It has the best of both, without the tag soup and doctype madness of XHTML.
XHTML (or HTML 5, for that matter).
We're talking about +10 years in web evolution. If you're the web developer or designer, go Strict and validate your code - it will assure that your site (given valid CSS) will display correctly in most operating systems and web browsers. It will be easier to maintain. It will make you a better webdev because you'll know and understand semantics. It will be easier to migrate to HTML 5 in the future too.

Is the HTML5 DOCTYPE the last one we will see?

The rather terse HTML5 doctype, <!DOCTYPE HTML>, seems to indicate that this the last HTML doctype we will see. Is this really true?
From what I understand the primary function of the various doctypes was to turn on the numerous quirks rendering modes of modern browsers. Surely there is nothing stopping this from happening again? i.e. people writing web=-pages against a 'broken' browser implementation, resulting in future browsers needing to employ doctype sniffing?
The idea of the new html standard is that it should be forward compatible.
If new standards arrive (html 6?) they should render normally on html 5 renderers, just not have all the new (future) features.
Read more about it here: http://www.alistapart.com/articles/semanticsinhtml5
(somewhere half way the page)
Another reason for the short doctype is that html5 has no DTD.
This question is probably quite subjective (no, I'm not voting for close). I think the W3C guys are quite optimistic (idealistic) about browser implementation of their standards, and so in that view we shouldn't need more doctypes. Any future HTML versions (in 2030ish?) will just add to the current one to allow for new technologies (because after all, it's perfect!) and so browsers will just need to implement the new features.
How it actually happens, I think we'll just have to wait and see. I predict that in some way, they will regret the terseness of <!doctype html>, although for what reasons I can't be sure.
I think that the "doctype html" will be enough.
http://blog.whatwg.org/html-is-the-new-html5
No more HTML4, HTML5 or HTML6... just HTML. They are moving from versioned to unversioned development model. Just a standard that is continuously evolving. So from now on, we should not ask whether my browser supports HTML5 or HTML6, but which are the features supported by my current browser.
Regarding to follow the standards, I think that the developer will be no more the only one to worry about this. Actually there is no browser with a market share big enough to impose its owns, (and even internet explorer its taking very seriously to implement the standards now)

HTML 5, what should I tell my clients?

More of my clients lately are asking me about HTML 5 and I'm trying to get a sense of what to tell them. How long until all the major browsers have standard support for it? How long until I leave HTML 4 behind and only code new projects in HTML 5? What are you telling your clients?
Are they asking about specific HTML5 features or HTML5 in general? At my company we haven't said anything to the clients, but we do set the HTML5 doctype as well as using some HTML5 markup - but only markup that works in non-HTML5 compliant browsers. HTML5 doesn't necessary mean you discard older browsers, it depends on which features you implement. You can still use audio and video tags, as long as you keep a flash fallback - as an example. HTML5 form tags are poorly implemented even in bleeding edge browsers, so using them are not an option.
I suggest you read Dive Into HTML5 to see how you can work with HTML5 today, but still support non-HTML5 browsers.
I'll throw in another link; Modernizr is a JavaScript library that come in handy if you want use bleeding edge HTML5 or CSS3 features, it detects support for HTML5 tags and some (all?) CSS3 properties.
You've already gotten some good answers, but I'll chime in as well. I wouldn't give your client a blanket "yes" or "no" on html5. I'd take a look at what all has changed and then break it down into sections based on how well it's supported.
The Doctype:
Nothing is stopping you from switching to the html5 DOCTYPE today. Even browsers that don't understand html5's new tags (most notably IE 6-8) will recognize <!DOCTYPE html> as a valid doctype and not switch into quirks mode. After declaring that your document is an html5 document, you're free to use (or not use) html5's new tags to your heart's content. Personally, I've started using the html5 doctype on websites -- even if I have no immediate plans to use html5's new features -- because there isn't any negative side effect, and as a bonus I don't have to try to remember the correct way to write a doctype and charset everytime I start a new page (which I have to do with html4/xhtml).
New (Layout) Tags:
Next, you have to figure out why your client is interested in using html5 in the first place. My guess is that they're interested because it sounds trendy and cutting edge. In reality, one of the biggest benefits of many new tags (such as <section>, <nav>, <footer>, <aside>, etc) is that they make your code much more readable than it would be if the page was filled with <div>s everywhere. This is a great advantage for the coder (and in the future it might help with accessibility), but right now, this change probably makes very little difference to the client.
New Features (Video and Audio):
Alternative, the client might have specific html5 features that they want their site to use. Two of the most popular are the <video> and <audio> tags. The great thing about these is that you can easily fallback to Flash, so you don't have anything to lose (as far as browser support goes) by using them.
Complex Features:
Other popular new features are <canvas>, geolocation, and local storage (not exactly html5, but related). For these, the fallbacks (if they exist) require a lot more work on your part. If your client really wants these features, you'll need to figure out which browsers they (or their customers and site visitors) are using, and what percent of their target audience they're willing to leave behind.
Conclusion
That got a little long-winded; long story short, I'd tell your client this:
"I'll gladly start using some html5 features immediately. Remember, though, that the specification is not finalized, and it will continue to change over the next 10 years. Around 50-60% of our clients may be using browsers that don't support some of html5's new features, so we'll need to do thorough analysis before adding certain complex features of html5."
If the clients are OK with using the browsers that support HTML 5 for their applications, then why not :)
If they don't want to use the browsers (and versions) that doesn't support HTML 5, then they can't have it, thats what I would say.
Edit:
OK let me put it this way. If they are asking for a suggestion, then ask them what browsers and versions are they comfortable with, if they fall into the area where HTML 5 is supported, then tell them that they can move to HTML 5, adding that its in a nascent state, but support is growing at a good pace.
How long until all the major browsers have standard support for it?
Never. If you look at HTML5 as a whole (which you shouldn't), no broser will ever support it. For each browser, there will always be dozens of features defined in HTML5 which the given browser does not implement.
How long until I leave HTML 4 behind and only code new projects in HTML 5?
The language hasn't changed. It's still HTML. So, you cannot say "I code in HTML 4" or "I code in HTML5". You code in HTML.
HTML5 introduces new features. For each feature, you decide independently if you want to use it in your projects. There is stuff defined in HTML5 that you can use today. On the other side, there is stuff defined in HMTL5 that currently isn't implemented in any browser. The point is, it depends on the given feature.
Another key question is: What browser(s) do the majority of your clients use? Since medium to large size companies tend to be very resistant to changing browsers, what they use now is what they're likely to use for the forseeable future.
For clients using mostly Firefox, the answer is that Firefox supports a good deal of HTML5 now (version 3.6), & even more in version 4 (2011). For clients using mostly IE, they'll have to wait until version 9 (2011).

New site - XHTML 1 Strict or HTML 5

I'm beginning a very large project in the coming weeks and am trying to decide if I should take the leap into HTML5 land or stick with my time trusted XHTML 1 strict.
The site will be huge. Thousands of pages, video, custom CMS system, lots of social media integration, etc. I'm trying to justify using the new technology, but am unsure (as I've never done a huge site in 5) if everything will go according to plan on older browsers.
I can sit there and talk all day long about the new technology that html5 brings, but when you're sitting in a board room full of execs and the site doesn't work on their IE6 machines...not good.
Let me know what you guys would do. - Thanks
Choosing to use the HTML5 vocabulary is an orthogonal issue to whether to use XHTML syntax. If you want to use HTML5 elements and still work with XML production tools, you can always use XHTML5.
HTML5 is not yet finished so to some extent you will be labelling your documents with a doctype of unknown quantity, and validating it isn't as easy. But if your project is going to be using elements like <video> at any point, using an HTML5 doctype makes sense. (Though hopefully if you are using a custom CMS it should be relatively straightforward to adjust the doctype it spits out in the future anyway?)
None of this is relevant to IE6 compatibility as such. IE6-8 will render the page the same with any of the Standards Mode doctypes, and won't ever render <video> regardless of whether you're using an HTML5 doctype. You will certainly need fallback for any HTML5 extensions you use, such as Flash for <video>. The extended HTML5 semantic elements like <section> or <article>, you don't really get anything for using anyway; avoid them for now.
While HTML5 is not fully complete, much of it can be used today. It was designed with compatibility in mind, so a number of the new elements will work in older browsers, even if they don't specifically support HTML5.
You can start using the new doctype - any browser will recognize it as valid. From there, you can do your layouts using the new semantic structural elements - section, aside, header, footer, etc. You'll need to style these a bit to get them appearing correctly, and there is a shiv script for IE compatibility. It takes a little work, but they provide much more semantic value than the generic div.
audio and video elements have fallback capabilities for older browsers, so by all means use them.
Various new form elements and attributes are not widely supported yet, so you probably won't get much value from them right now. Though I quite look forward to using them, as they will reduce need for client-side scripting a fair bit.
IE6 is the obvious element in the room, but with the right setup, and use of fallbacks in HTML5, there should be no serious issues from using HTML5. CSS is another matter, of course. But IE9 is looking rather good, and will help to raise the bar for standards support.
HTML5 is a better choice here. It offers improvements as well as compatibility; and will render in all browsers. Modern features such as <video> can be sniffed for and replaced by FLV players or other alternative in non-compatible browsers.
XHTML has been redundant since its creation, and XHTML 1.0 (when sent with the correct mime type) doesn't work at all in IE6. Using HTML5, it will both render and be functional, assuming you handle the lack of support of modern features properly.