views:

294

answers:

4

Please write code. How will HTML5 code differ from HTML4?

+8  A: 

Read

HTML 5 differences from HTML 4

rahul
Though no codes which the OP requested, still a good reference. +1
o.k.w
It would probably be better to link to the latest version of that document, located here: http://www.w3.org/TR/html5-diff/
Mathias Bynens
Is there a difference between those two documents?
rahul
As far as code samples are concerned I don't think those will fit in this posting.
rahul
@okw: there is code on the linked page...
DisgruntledGoat
@pulse: Not currently, but the link I provided in my comment will always point to the most recent version of that document.
Mathias Bynens
+4  A: 

To start with one of the possible HTML 4 doctypes are as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;

And the HTML5 doctype is this:

<!doctype html>

The w3 have an article on the differences between the two specifications, lets remember that the HTML5 specification is not finalised yet, and is subject to change.

ILMV
yea, considering HTML4 was conceived in 97, we still have compatility issues. HTML5 better be a good one.
o.k.w
+5  A: 

One example borrowed from: A List Apart - A Preview of HTML 5:

HTML 4:

<body>
  <div id="header">...</div>
  <div id="nav">...</div>
  <div class="article">
    <div class="section">
      ...
    </div>
  </div>
  <div id="aside">...</div>
  <div id="footer">...</div>
</body>

HTML 5 adds new elements to specifically identify each of these common constructs:

<body>
  <header>...</header>
  <nav>...</nav>
  <article>
    <section>
      ...
    </section>
  </article>
  <aside>...</aside>
  <footer>...</footer>
</body>

These elements are summarized as follows:

  • section: A part or chapter in a book, a section in a chapter, or essentially anything that has its own heading.
  • header: The page header shown on the page; not the same as the head element.
  • footer: The page footer where the fine print goes; the signature in an e-mail message.
  • nav: A collection of links to other pages.
  • article: An independent entry in a blog, magazine, compendium, and so forth.
  • aside: For content that is tangentially related to the content around it, and is typically useful for marking up sidebar
Daniel Vassallo
+4  A: 

Compare these two files:

A detailed explanation can be found in chapter 3 of Dive Into HTML5, titled “What Does It All Mean?”.

Mathias Bynens
where?!........
Matt Joslin