Depending on who you ask, HTML 5 is either the next big step toward creating a more semantic web, or it’s just an incomplete hodgepodge of tags and markup. The network is in trouble.
The problem for both sides of the argument is that very few sites are using HTML 5 in a natural environment, so theoretical solutions to the now-recognized problems remain largely untested.
That said, it’s not hard to see the benefits and potential pitfalls of next-generation web markup tools.
1. What’s different about HTML 5?
2. Finally, a document type that anyone can remember
3. The most basic semantic structure
1.
2.
3.
1.
2.
3.
4. Put them together
5. Writing styles for new elements
6. Compatible with old browsers
7. Now you can use HTML 5, but will you use it?
First of all, what do we express through HTML 5? First off, what do we mean by HTML 5? In theory, we express everything - new semantic structure tags, such as canvas or offline storage API specifications, and new inline semantic tags. However, we limit the actual reason (PS: browser support issues) to structure tags only. canvas, offline storage, local video or geolocation APIs are all great, however they are not yet supported uniformly by all browsers.
“But wait” you say, “most browsers don’t support the new structural elements either!” It’s true, but the vast majority of them will happily accept whatever you want to create Label. Even IE6 can handle new tabs, although if you want to style it with CSS, you'll need a little help from JavaScript.
One thing you need to remember when styling new tags is that unknown tags do not have a default style in most browsers. They are also considered row-level elements. Still, since most of HTML 5's new tags can be constructed, we'll give them the behavior of block-level elements. The solution is to make sure you include display:block; in your CSS style.
To help understand some of the new stuff in HTML 5 today, let’s get down to business now and start using some new structural elements.
The first thing we need to do to create an HTML 5 document is to use the new document type. Now, if you clearly remember the HTML 4 or XHTML 1.x document types, you are a bigger naughty guy than we are. Whenever we create a new page, we have to open an old file, cut and paste the document type definition.
This is a real pain, and why we love the new HTML 5 document type . Are you ready? He appears:
It won’t be too difficult to remember. Simple and easy to understand. Not case sensitive.
The idea is to stop HTML versioning and make backward compatibility easier. Whether it's successful in the long run is another matter, but at least it saves you the average time of typing.
We have defined our page as an HTML 5 document. So far, so good. Now, what exactly are these new labels we've been hearing about?
Before we delve into new tags, think about the structure of your average web page, something like this:
This is fine for presentation purposes, but what if we want to know something about what the page element contains?
In the above example, we added IDs to all our structural divs. This is common among knowledgeable designers. The purpose is twofold, first, the ID provides an anchor that may be used to apply styles to particular paragraphs of the page, and second, the ID acts as a basic pseudo-semantic structure. A sophisticated parser will look at the tag's ID attribute and try to guess what they mean, but that's difficult when the ID names are different for each site.
This is where the new structure tag comes in.
Recognizing that these IDs had become a convention, the creators of HTML 5 went a step further and made some of these elements their own tags. Here's a quick summary of the new tags taking effect in HTML 5:
head tag is designed as a container for introductory information about a chapter or an entire web page. The nav element is pretty obvious, it’s your navigation element. Of course there is some debate about what counts as navigation. There is a basic site navigation, but in some cases there may also be page navigation elements. The creators of HTML5, WHATWG, have recently modified the explanation of For more information about nav and the heated debate about HTML5, see Jeffrey Zeldman’s article on the nav element . If you are still using the