Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I prefer HTML5 to HTML4 in this case?

Tags:

html

HTML 5

<section>
    <article></article>
    <article></article>
</section>

HTML 4

<div>
    <div></div>
    <div></div>
</div>

Both of these have to be aligned by CSS. What exactly is the use of HTML 5? Yes there are form tags in HTML 5 that are very useful, but I'm concerned with the above.

like image 200
X10nD Avatar asked Jun 25 '11 19:06

X10nD


People also ask

What is the advantage of HTML5 over HTML4?

HTML5 gives developers more control over the performance of their websites. Many of the Flash and JS-based hacks commonly used in HTML4 are now elements inherent to the language. These changes also allow for a faster and smoother user experience.

Is HTML5 better than HTML4?

HTML 5 is the latest and more advanced version of HTML 4. HTML5 comes with new tags, new features, and has simplified various functions.

Why is HTML5 the best?

This makes it perfect for any business to make use of from start-up to enterprise. What makes HTML5 better? One of the biggest changes which HTML5 brings is the ability to present video and audio on your site without having to use flash or an external media player. This wasn't possible in HTML4.

What is the main difference between HTML4 and HTML5?

HTML 4 is generally supported by many third-party elements, such as Flash. HTML 5 is fully supported by multimedia. HTML 4 has no provisions for new tags. HTML 5 introduces many new tags, such as canvas, audio, video, etc.


2 Answers

One word: semantics.

See http://www.webmonkey.com/2010/02/building_web_pages_with_html_5/#Semantic_structure_at_last

EDIT: To paraphrase the article, by request (and rightly so), HTML 5 has added a set of new tags, such as article, section, nav, header, footer, and others that have, traditionally, been created manually in HTML 4 by using div tags and semantic ID values (eg. <div id='header'>.

By creating these new semantic tags, it allows for easier to understand markup for humans, as well as being easier to parse semantically by machines. For example, it will be easier to write code that crawls web pages looking for article content (think blog search) with a standardized tag, rather than having to search pages full of divs.

like image 146
ETWW-Dave Avatar answered Nov 07 '22 13:11

ETWW-Dave


A few reasons off the top of my head:

1) It's more explicit and space saving to separate specific components of your website Example:

<section>
    <article>
    </article>
</section>

vs.

<div class='section'>
    <div class='article'>
    </div>
</div>

It's also takes up less space to directly reference each of these parts in CSS or JavaScript.

2) Similarly, it can be easier for screen readers and the like to extract useful information from a page for those who are blind or visually impaired.

like image 43
Chris Laplante Avatar answered Nov 07 '22 14:11

Chris Laplante