views:

1298

answers:

7

I am taking a peek at Dive Into HTML5. It seems nice and interesting, but I am puzzled.

In the 1990s, at the time when Netscape was the browser and HTML was HTML2 or HTML3, there were a lot of tags: address, cite, code... Most of them are unused as of today, probably even obsolete.

HTML5 introduces tags to express "semantic meaning" to the tag itself. This is all fun and games, but I see something very strange in this approach. Technically, the semantics can be very open ended. HTML5 has tags for article, time, navigation bars, footer. Why shouldn't it contain tags for post icon, author's place, name and surname, or whatever else you want to assign specific semantics to (I'm confident <rant> and <nsfw> would be very important tags): ? I thought XML was the strategy to assign semantics to stuff. Nothing forbids you to put an XML chunk under a XHTML div element, and assign a stylesheet to it so to style it properly, or to delegate to the proper viewer the handling of that namespace (for example, when handling RSS or SVG).

In conclusion, I don't understand the reason behind this extensions focused towards semantics, when it's clear that semantic is a very broad topic, which is guaranteed to require a potentially infinite amount of semantic tags. Since I am pretty sure there are clever people at W3C, I think I'm wrong, but I'd like to know why.

+3  A: 

There is already a lot of semantics in HTML markup in the forms of classes and IDs, of which there is a (near) infinite amount of possibilities of, And everyone has their own way of handling these semantics. One of the goals of HTML5 is to try to bring some structure to this. you will still be able to extend the semantics of tags with classes and ids. It will also most likely make things easier for search engines.

GSto
That's the fact. you should not assign or infer semantics from classes or ids (at least according to the diveintohtml5 section about semantics)
Stefano Borini
why not? where else are you going to have any kind of semantic markup (in current HTML)?
GSto
well, I think it's because the id is well, an identifier, and the class is an attribution for visual representation.
Stefano Borini
semantics in the form of machine readable markup can be added in the form of classes and ids -- see the way it's done at http://en.wikipedia.org/wiki/HCard - this is markup that a search engine, or browser, or browser plugin can consume.
artlung
Technically, there's no such thing as near infinite.
hasen j
>Technically, there's no such thing as near infinite Where's the <pedantic> semantic tag when we need it?
brian b
+1  A: 

I just want to address one part of your question. You say:

In the nineties, at the time when Netscape was the browser and html was HTML2 or HTML3, there were a lot of tags: address, cite, code... Most of them are unused as of today, probably even obsolete.

There are a great deal of tags to choose from in html, but the lack of usage does not imply that they are obsolete. In particular the header tags <h1>, etc, and <ul>, <ol> are used to join items into lists in a way I consider semantic. Many people may not use tags semantically, but the effort to create microformats is an ongoing continuation of the idea you consider an artifact of the 1990s. Efforts to make the semantic web be a winner keeps going, despite full-text search and link analysis (in the form of Google) being the winner as far as how to find and understand the web.

It would be great to see an updated version of Google's Web Stats which show "html as she is spoke." But you are right that many tags are underused.

Whether html5 will be successful is an open and interesting question, but the tags you describe as obsolete didn't go anywhere, they were there in HTML 4.01 and xhtml. HTML5 seems to be an effort to solidify what is useful in tags. In the end if html5 gets support in browsers and makes the job of web developers easier, it will succeed. xhtml2 failed because it roundly failed to gain adoption in browsers and did nothing to make the job of web page makers easier. The forces working on html5 seem keenly aware of the failure of xhtml2, and I think are avoiding having html5 suffer a similar fate.

artlung
xhtml2 failure had nothing to do with browser support. It failed because it was neither forward nor backward compatible and the W3C did not want to have a radically different competing format to the more popular HTML 5 regardless of any weaknesses or strengths inherent to HTML5.
+12  A: 

Why are tags for article, time, navigation bars, footer useful?

Because they facilitate parsing for text processing tools like Google.

It's nothing about semantics (at least in 'broad' meaning). Instead they just say: here is the body of page (most important text part) and there is the navigation bar full of links. With such an approach you can easily extract just what you need.

Trickster
A: 

I disagree with adding extra tags. If detailed vocabulary were actually import then there could be a different tag name for every word in the dictionary. Additional tags names are not helpful as they may communicate additional meaning to humans, but do nothing to facilitate machine parsing of the language. This is why I don't like the "semantic" tags for HTML5 as I believe this to be slippery slope to providing a vocabulary too complex while only providing a weak solution to a problem not fully addressed.

In my opinion markup language structure data as much as describe it in a tree diagram form. Through parsing of the structure and proper use of semantic conventions, such as RDFa, context can be leveraged to provide specific meaning to otherwise generic tag names. In such as case excessive vocabulary need not exist and structurally redundant tag names, such as footer and aside, could be eliminated. The final objective is to make content faster and more accurate to interpret by both humans and machines simultaneously while using as little code as possible to achieve that result. How that solution is lesser important, except to HTML5.

+1  A: 

Look at it from the angle of trying to make statements either about the page, or about objects referenced from the page. If you see a <footer> tag, all you can say is "stuff in here is a footer" and pass it by. As such, adding custom tags is not as generic a solution as adding attributes and allowing people to use their own choice of URIs to specify predicates and optionally values - RDFa wins hands-down because you can express any triple-statement you like from RDF in a page, one way or another.

Tim Haynes
+4  A: 

I too hate the way that W3C is going with their specs. There are many things that I don't like, and this "semantics" fad is one of them. (Others include taking forever to complete their specs and leaving too many important details for the browsers to implement as they choose)

Most of all I don't like it because it makes my work as a web developer more difficult. I often have to make a choice whether to make the webpage "semantically correct" or "visually/aesthetically pleasing". The latter wins of course, because that is what the users want, but as a result validations start failing and the whole thing gets quite non-semantic (tables for layout and other things).

Another issue at which I frown is that they have officialy declared that the "class" attribute is for semantics, but then they used it for visual presentation selectors in CSS.

Bottom line - DON'T MIX SEMANTICS AND VISUAL REPRESENTATION. If you use some mechanism for describing semantics (like tag names, attribute values, or what not else), then don't use it for funcional/visual purposes and vice versa.

If I would design HTML, I would simply add an attribute "semantic" which could (like the "class" attribute) be added to any tag. Then there would be a number of predefined values like all those headers/footers/articles/quotes/etc.

Tags would define functionality. Basically you could reduce HTML tags to just a handful, like "div", "table/tr/td", "a", "img", "form", "input" and "select". I probably missed a few but this is the bulk. Visual styling would be accomplished through CSS.

This way the three areas - semantics, visual representation, and functionality - would be completely independent and wouldn't clash in real life solutions.

Of course, I don't think W3C is interested in practical solutions...

Vilx-
By adding a `semantic` attribute you're essentially validating the usefulness of the semantics effort, but putting it in a different place in the code. This is fine, but the notion that tags should correspond to *functionality* does dismiss the actual purpose of the HTML language, which is to describe *documents*, which are inherently *semantic*, not *functional*. I think this really gives rise to the need for a separate environment for *documents* from *applications* (the latter of which could contain instances of the former). (cont'd)
eyelidlessness
If you're going to go that route, and represent *applications* with HTML syntax but only a subset of HTML elements, I'd say that it's high time to introduce a whole slew of new widgets, particularly form type widgets. I think this is where the flaw in the idea becomes most evident. HTML is woefully lacking in functional elements, leaving them to be implemented primarily in a client-side script. All of that is fine because HTML today serves as a hybrid between documents and applications. Were this idea pursued, we'd end up with two wildly divergent HTML languages, and broken sites as a result.
eyelidlessness
Anyway, where your idea misses the mark completely is that it dismisses the value of *predictability* of HTML semantics. Unless your idea is coupled with a defined set of acceptable `semantic` attribute values, the semantics may as well be completely meaningless except to the markup author. And if it *is* coupled with such a set of values, it's pretty much an exact duplication of the HTML5 semantics efforts.In my opinion, the real problem with the HTML5 semantics efforts is that the defined set of semantics is still way too small to accommodate actual real-world use.
eyelidlessness
Regarding making choices between semantics and presentation, there is no such choice. All of the semantics, coupled with the CSS standard, are capable of all of the functionality of the semantically erroneous easy-way-out alternatives. Even table-based layouts (whose appeal is lost on me, but to each their own) can be accomplished without table semantics (and to an almost perfect extent, can be worked around to be backwards compatible all the way back to at least IE 6): http://bit.ly/MIrzS. There is no excuse not to use semantic HTML except laziness.
eyelidlessness
+1 to your first comment about a new environment for applications. HTML/CSS/JS was never meant for what it is (ab)used today. But alas - we cannot change it, or at least it seems that this idea is completely lost on W3C. All they think about is documents, while real world users demand applications. And the web developers are the ones who are in the middle and have to suffer for this.
Vilx-
About the values of the semantic attribute - yes, I was thinking of a list of predefined values. But it doesn't have to be a fixed non-changing list, because, as you correctly note, that list will probably be too small anyway. Instead W3C could have a list of **recommended** values, which search engines and other machine processors would honor, and therefore encourage developers to use them. The list however could get new elements every now and then, and it wouldn't invalidate existing documents, make them semantically incorrect, or require a lengthy reworking of the whole standard.
Vilx-
And I'd like to disagree about table-based layouts. Unfortunately there ARE things that require a table layout. Most of them have to do with automatic resizing. When the sizes are fixed, there is indeed no problem representing everything with DIVs and SPANs, and it is even easier. If you want an example of such a problem, ask me.
Vilx-
Regarding the predefined-but-open-ended list of semantics, I think this rather calls out more for an evolution of the HTML language (and all of its interpreters) to allow for custom tag semantics (without the namespace mess of XHTML). I don't think moving the semantics out of the tag name into an attribute has any real benefit, but I think there is truly a need for an evolving set of semantics, and some kind of a way to determine de-facto standards as they evolve.
eyelidlessness
Regarding table layouts, I'm curious if you looked at the link I posted. Table layouts without table semantics can be done, today. That said, I have little problem with flexible-size grid-type layouts without table layout. I'd like to see such an example, and offer to try to reproduce without table layout, but I will be honest and say I won't have the time available to devote to it for some weeks.Good discussion though!
eyelidlessness
HTML5 is from WHATWG, independent from the W3C.
Nicolás
WHATever. Doesn't change what said.
Vilx-
Oh, I just remembered one tiny simple thing which is available only with tables - vertical centering of contents. AFAIK there is no other way.
Vilx-
You definitly make some good points. I think theoretically you should be able to style your semantic elements. So you can give a semantic class of headerLinks and this will always look the same. The problem is any decently complex layout in CSS/HTML makes this impossible since you often need to wrap elements in other elements just to get the right layout and suddenly semantics are broken.
Matthew Manela
+1  A: 

"Why shouldn't it contain tags for post icon, author's place, name and surname, or whatever else you want to assign specific semantics to (I'm confident and would be very important tags): ?"

You use <dialog> to describe conversations or comments. Rant and NSFW are subjective terms therefore it makes sense not to use them.

From what I understand a bunch of experienced web developers did research and looked for what most websites have in common in html. They noticed that most websitse have id="header", id="footer", id="section" and id="nav" tags so they decided that we need HTML tags to replace those id's. So in other words, don't expect them to give you a HUGE amount of HTML vocabulary. Just keep it simple as possible as you can while addressing the MOST common needed HTML tags.

NAV tag is VERY important for providing accessibility as well. You want them to know where the navigation is rather than to force them to find whether links are for navigation or not.

netrox