首页 > Web开发 > 详细

basic html5

时间:2014-11-28 21:15:37      阅读:466      评论:0      收藏:0      [点我收藏+]
  html4 doctype
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 HTML5 doctype:
 <!DOCTYPE html>

 In this example page, the root element looks like this:

  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

  The first thing to discuss is the xmlns attribute. This is a vestige of XHTML 1.0.
  It says that elements in this page are in the XHTML namespace, http://www.w3.org/1999/xhtml.
  But elements in HTML5 are always in this namespace, so you no longer need to declare it explicitly.
  Your HTML5 page will work exactly the same in all browsers, whether this attribute is present or not.

  Dropping the xmlns attribute leaves us with this root element:

  <html lang="en" xml:lang="en">

  Why two attributes for the same thing? Again, this is a vestige of XHTML. Only the lang attribute has any effect in HTML5.
  You can keep the xml:lang attribute if you like, but if you do, you need to ensure that it contains the same value as the lang attribute.

  Are you ready to drop it? It’s OK, just let it go. Going, going… gone! That leaves us with this root element:

  <html lang="en">

  Example page:

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>My Weblog</title>
  <link rel="stylesheet" type="text/css" href="style-original.css" />
  <link rel="alternate" type="application/atom+xml"
                        title="My Weblog feed"
                        href="/feed/" />
  <link rel="search" type="application/opensearchdescription+xml"
                        title="My Weblog search"
                        href="opensearch.xml"  />
  <link rel="shortcut icon" href="/favicon.ico" />
</head>

对于
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;" charset="ISO-8859-1">
可以简化成
<meta charset="utf-8" />
对于
<link rel="stylesheet" href="style-original.css" type="text/css" />
可以简化成
<link rel="stylesheet" href="style-original.css" />

basic html5

原文:http://www.cnblogs.com/pimp/p/4129282.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!