Which Html Version Should Be Chosen For A Public Website
Solution 1:
HTML5 Features
If you mean the HTML5 features, you must understand what HTML5 really is. I would define it has the culmination of the previous specs as well as newer and richer features. It is made to support existing content (backward compatible) and to support the creation of web applications. What is really awesome is the fact that it does not only stop there. It states for the first time how browsers should deal with error handling.
Now, you need to know that not all features are implemented in browsers. You can take an HTML5 browser test to know what works and what doesn't. That does not mean that they will not work! Most browsers actually allow you to use and style any element you care to invent. The new HTML5 tags have no default style in browsers that do not support them.
The following CSS code would be enough for most browsers:
section, article, header, footer, nav, aside, hgroup {
display: block;
}
As always, Internet Explorer (IE) has special needs. Only, there is a JavasScript magician who goes by the name of Remy Sharp that has created a JavaScript file that creates each element for IE. So you could add this in your page:
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
</script>
<![endif]-->
By the way, you will have to use JavaScript to be able to test the existence of new HTML5 elements and give an alternate choice to those who have browsers that are not up to speed with certain HTML5 element and attributes. This is why there is this little generic JavaSCript function that you can use to do just that:
functionelementSupportsAttribute(element, attribute) {
var test = document.createElement(element);
if(attribute in test)
returntrue;
elsereturnfalse;
}
One last note, I got most of this information from the book HTML5 For Web Designers. Kudos to Jeremy Keith!
HTML5 Doctype
If you mean the new doctype one <!DOCTYPE HTML>
, here is what I have to say...
It isn't illegal to use features from previous HTML/XHTML version in HTML5. Note that the new doctype does not have any number associated with it. That is because it is meant to build upon existing specs and to be valid for future versions. Therefore, I say that you go with the new doctype.
You can have a look at the spec on the W3C site. In short the spec says this...
8.1.1 The DOCTYPE
A DOCTYPE is a required preamble.
DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications.
[...]
For the purposes of HTML generators that cannot output HTML markup with the short DOCTYPE "
<!DOCTYPE html>
", a DOCTYPE legacy string may be inserted into the DOCTYPE (in the position defined above).
Solution 2:
HTML5 is a set of mostly-unrelated features.
You can use whichever features you want; you just need to be aware of which browsers support which features.
Solution 3:
Unlike other languages, you don't have to choose between HTML 5 and XHTML. I think your question is coming form seeing the DOCTYPE
string at the top of HTML source. You should include a DOCTYPE
, but it doesn't matter much to browser support.
The right question to ask is if there is browser support for the features you want to use. Every browser supports some features of HTML 5, since most of HTML 5 is the same as HTML 4 and XHTML. Consider your target audience and what browsers they probably use and then look up how well those browsers support the features you want to use.
In short, you don't have to decide if you want to use HTML 5, you need to decide individually on a feature-by-feature basis if that feature is well enough supported (no matter if that feature is an HTML 5-specific feature or not).
This is a good resource for browser support of some of HTML 5's new features: http://www.findmebyip.com/litmus
Solution 4:
Depends entirely on the users of the website, and which features their browsers support. As SLaks said, HTML5 isn’t an all-or-nothing proposition.
Mark Pilgrim has two good chapters on detecting support for HTML features via JavaScript (which is the only reliable way to do it):
You use the same approach here that developers have always used for front-end web code — use new features in such a way that users who don’t have that feature yet can still use the site, even if the experience isn’t as slick for them.
Post a Comment for "Which Html Version Should Be Chosen For A Public Website"