views:

443

answers:

6

I'd like to use some semantic [X]HTML tags instead of <div>s: <article>, <product>, <footer> etc. Some of them are already presented in the upcoming HTML5, however, it's not fully supported.

Which are the possible cons I might face when Rendering? Using CSS, JS?

The one I remember is: IE6 can't clone tags it doesn't know.

+4  A: 

Generally speaking, it's inadvisable to use custom html tags. There is nothing you can do with custom tags that cannot be done with native HTML tags. You can read : When to use custom html tags?

Babiker
+1  A: 

Unless you're developing for a very limited set of browsers, this sounds like a bad idea. If it works at all in older browsers, it won't work well; it'll be years until we can expect good HTML 5 support from all common browsers.

Dean J
+2  A: 

Adding the following JavaScript fix makes custom HTML5 tags work in IE. In fact they work in every other browser I have tried. I have built my website using HTML5, and although it doesn't look great in IE6&7, it still works. Here is the code you put in your template header:

<!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt; <style type="text/css"> .clear { zoom: 1;display: block;} </style> <![endif]-->

Using HTML5 tags gives you increased control using CSS due to their semantic nature. It is actually a lot easier making sites, as they are easier to understand if you use the tags correctly.

Using divs everywhere is fine, because if they have appropriate ID's and classes, they are still semantic, but with the HTML5 tags, you can recognize page structure a lot faster.

danixd
Could you please describe what's exactly not working properly in IEs with custom tags?
o_O Tync
IE won't style elements it doesn't recognize. The javascript enters those values into the DOM, iirc, so it will work.
Rob
That's not a “Google fix”, the HTML 5 shiv is only hosted on a Google web site.
Marcel Korpel
“IE won't style elements it doesn't recognize” — just to clarify, IE won’t style them (see e.g. the `<abbr>` tag) or let you style them via CSS, until you use the JavaScript fix above or a similar one.
Paul D. Waite
Thanks! I will check this out and report if anything goes wrong with custom tags
o_O Tync
+1  A: 

Even if you use JS to make IE 6 "recognize" HTML5 tags, you'll still have problems, since IE 6 will not allow to nest such tags.

On the other hand, if your web page is not application-oriented, but purely for presentation, you could as well use plain old XML with styling. It differs a bit from the traditional way of making pages, but in XML terms there are no "old" or "new" tags.

See this page -- http://feeds.feedburner.com/blogspot/MKuf (Google's blog feed) -- as an example of styled XML. JS and DOM API's work just as well.

+2  A: 

This doesn’t entirely speak to your question, but <product> isn’t semantic as far as computers are concerned.

A human can read it and think “Aha, this must be a product, which in the context of this shopping website means something I can buy, and therefore doesn’t mean ‘a quantity obtained by multiplying quantities’ as it might do on mathoverflow.com”. That’s genuinely useful for any human reading the code, so it’s semantic in that sense.

But as far as a computer parsing your page as HTML is concerned (or a human viewing your HTML page in a browser instead of reading the code), it’s just an unknown tag, and thus won’t get any useful default styling (unlike the <p> tag, which gets nice margins to make things readable on-screen) or behaviour (unlike the <a> tag, which is clickable if you give it a href attribute).

Computers only get semantics when people agree what tags mean, via specs like HTML5.

Paul D. Waite
… and even if you style them, that leaves people who don't get the stylesheets (e.g. because they use a braille reader, a screen reader, or are a search engine) out in the cold.
David Dorward
A: 

Hi I would like to know the "pros and cons of Dashboard and how is it better for development for Web app rather than plain simple HTML or WebKit ObjC API"

Regards' Mreetyunjaay

Mreetyunjaya