Everyone’s buzzing about it. HTML 5 – but are we ready for it yet? Short answer: YES! Of course the new spec isn’t going to be mainstream for quite some time but if we can use these now…then why the heck not? The tags that I’m initially interested in are the ones that we can put to use right away ie: <header />, <footer />, <nav />, <section />, <aside /> and of course <audio /> and <video /> Keep in mind these are only a handful of nodes that we have at our disposal. Check out the html5 draft spec for a full listing and explanation of each node. While I was playing around, out of curiosity, I decided to check my code out in IE6-8. 8 had the most support but with 6…forget about it. I knew that IE’s rendering engine is very forgiving (regardless of the version) and will still render unknown tags but we run into a couple of problems. Unknown tags are treated as inline elements AND for whatever reason my css rules weren’t honored. I scratched my head with this for a bit and remembered a similar incident with IE6 and I decided to throw JS into the loop. If you introduce unrecognized nodes via JS your CSS rules will magically be applied…now that’s what I call black magic. This does look very hacky and I wouldn’t recommend this in a production environment but you’d simply create a new node using document.createElement(‘header’). This will only work if it is inserted in the <head> of your document but at least your CSS and new HTML5 tags will render correctly with that fix.
Posts for Category: HMTL5
-
-
When xHTML ‘came out’, I was so pleased with the way the industry was moving. Standards, Semantics and Structure. I like to believe that the majority of developers (at least the better ones) like to have structure and order. I still find myself being bothered by people who write sloppy code. There’s nothing worse for me than to see all kinds of tag being opened and forgotten about. For example <li>‘s <div>‘s <p>‘s; the list can go on forever. That’s where I feel that HTML 5 has gone wrong. HTML5 will no longer force strict syntax and I see that creating problems. I’m trying to rationalize this and the only thing I can come up with is that you have two mindsets when it comes to web site development. Some people want to provide a real quality product (following all standards) and other people simply want it to work. So basically you have two groups: Those that really care about the quality of our industry and those that don’t. I used to be asked, “Well does it work?” And I would HATE to have to respond because the answer is, of course it works BUT…and that’s when you get cut off lol. Anyway, while I believe HTML5 will cause confusion and conflict between developers different coding techniques, people like me will still have to force the issue in that I want nothing BUT strict syntax. Ok, so that’s what I see as what’s ‘bad’ with HTML5. Now onto the good. The good thing is that we don’t have to wait to start using HTML5. As a matter of fact it is already being used. It’s pretty easy to declare an HTML5 document: <!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>HTML5 complete</title> <!—[if IE]> <script src=“http://html5shiv.googlecode com/svn/trunk/html5.js”></script> <![endif]—> <style> article, aside, figure, footer, header, hgroup, menu, nav, section { display: block; } </style> </head> <body> <p>Hello World</p> </body> </html> Piece of cake right? What HTML5 is really geared toward is defining ONE single language that can be both HTML and XML. Its attempt is to resolve many issues found in all the previous iterations of HTML to address many needs of web applications. Here are a few links to help with the HTML5 transition:
- Current HTML5 Draft – http://www.whatwg.org/specs/web-apps/current-work/
- Differences between HTML5 and HTML4 – http://www.w3.org/html/wg/html5/diff/
- HTML5 FAQ – http://blog.whatwg.org/faq/