I am currently working on a website. After studying HTML5 and its features I want to go ahead with it. I want to use features like offline storage, data- attribs, simple cha
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:
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:
function elementSupportsAttribute(element, attribute) {
var test = document.createElement(element);
if(attribute in test)
return true;
else
return false;
}
One last note, I got most of this information from the book HTML5 For Web Designers. Kudos to Jeremy Keith!
If you mean the new doctype one , 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 "
", a DOCTYPE legacy string may be inserted into the DOCTYPE (in the position defined above).