what html5 features are already safe to use in a cross browser way?
I'm already using the HTML5 Doctype in all my pages. Are there any other html5 specifications/featur开发者_运维知识库es I can start using right now?
The conditions are:
- Cross browser - support for IE6 is optional but please specify
- No hacks please [javascript or otherwise]
- its completely acceptable if the feature degrades gracefully in older browsers
Of note would be some of the HTML5 input
types. As far as I know any browser that doesn't recognize a type on an input
element, defaults to type="text"
. The added value is minimal, but it's worth being aware of.
On devices running the iPhone OS for example, an element like:
<p><label>Telephone: <input type=tel></label></p>
or,
<p><label>Email address: <input type=email></label></p>
would bring up an appropriate keyboard, giving importance to characters frequently needed in the respective
input
.
Given the immense semantic and user experience value, and the graceful degradation, I've adopted this on production sites without detriment. In some cases, especially with mixed doctypes
, you could lose out on validation, but that's to be expected in a transitional period, and a sacrifice I'm willing to take.
A lot of good info on the W3C site, regarding the updated form elements and specs.
If IE7 is your lowest supported browser requirement, none (since it came out long before HTML5 was being considered by anyone, never mind Microsoft).
Quirksmode has a feature availability chart: http://www.quirksmode.org/dom/html5.html
Depends on what you consider an "HTML5 feature". A lot of "new" features in HTML5 are actually reverse-engineered from IE. insertAdjacentHTML
, for example, is supported in IE4+. Even innerHTML
can be considered an HTML5 feature, as it has never been in a standard before. The features that were specifically designed in HTML5, such as section
and <input type=tel>
, on the other hand, are very unlikely to be implemented in IE7.
(Also note that IE7 came out in late 2006, while work on HTML5 started in 2004.)
There are several since, as ms2ger points out, many of the "new features" are actually old IE features:
- Block level links
- Content editable
- Drag and drop
- XHR
I've take HTML5 to refer to 'specs originated at WHATWG' rather than strictly 'stuff in the HTML5 spec', since everyone else seems to. And, yes, that last one is probably cheating ;)
精彩评论