开发者

How will the key features of HTML5 work, contrast to HTML4? [closed]

开发者 https://www.devze.com 2022-12-16 22:19 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_JAVA百科 Closed 11 years ago.

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


Read

HTML 5 differences from HTML 4


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


Compare these two files:

  • http://fortuito.us/diveintohtml5/examples/blog-original.html (XHTML 1.0 Strict)
  • http://fortuito.us/diveintohtml5/examples/blog-html5.html (HTML5)

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


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">

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号