Hi I am studying html5 and have a hard time understanding exactly how those tags function.Maybe I am used to the old div tags and cannot figure out what is going on. For example I look at a page made with html5 and css3.In the page there are 3 article section one on top of the other, 2 on the side and 3 more on the bottom.Looking at the source code all the tags are articles, no class or id to identify them and no positioning whatsoever(I cannot see any anyway).How do they do it? Thank you for your help.

Recommended Answers

All 2 Replies

The main purpose of these new elements is to provide the element itself with meaning (semantics). For example, prior to HTML5, if you wanted to create a navigation menu or footer, you would create divs as follows:

<div id="navmenu"></div>....<div id="footer"></div>

With HTML5, you can use newer elements so that user agents (browsers/spiders) can have a better understanding of the purpose of the content within the element. if a spider comes accross a <footer> element, it will have a better understanding of its purpose.

With regard to class or ids, you may not need them because you can select these elements by type in your stylesheet. For example..

section { ... }
aside { ... }

You should note that HTML5 elements are not supported accross all browsers that are currently in use. For older browsers, specifically IE, you will need to include a html5shiv so that you can select these elements in your style sheet. browers, by default, will ignore elements that they are not familiar with. However, most browsers, except for IE, will allowing styling of unfamiliar elements. the html5shiv addresses this issue.

Hi thank you for your help.I am starting to understand how it works. I was able to create a page using the new tags.I see that a lot of the html4 tags are now obsolete like hspace and vspace, also cellspacing and cellpadding and that you are supposed to position the elements setting margins and paddings.Actually I think the main diference is that with the div tags we were using coords like top so many px and left or right so many This makes it cleaner and easier interesting,thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.