[XHTML Tutorial] 走向XHTML标准 (3)(Differences Between XHTML And HTML)[1]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 lovewangshu 的 blog

原文地址:http://www.w3schools.com/xhtml/xhtml_html.asp
翻译:范维肖

you can prepare yourself for xhtml by starting to write strict html.
你可以通过开始书写严格的html代码来为你的xhml之路做准备

how to get ready for xhtml
如何开始xhtml呢?
xhtml is the next generation of html, but it will of course take some time before browsers and other software products are ready for it.
xhtml是html的下一代语言,当然,在新的浏览器和其他的相关软件产品出现之前,它将延迟一段时间才能普及。
in the meantime there are some important things you can do to prepare yourself for it. as you will learn from this tutorial, xhtml is not very different from html 4.01, so bringing your code up to 4.01 standards is a very good start. our complete html 4.01 reference can help you with that.
其间,有一些重要的事情你能够去做来为它的学习做准备。就像你可以从这篇指南学到的东西一样,xhtml不是与html4.01有很多不同的,所以把你的代码改写程4.01标准是一种非常好的开始,我们完整的html4.01参考可以帮助你解决这个问题。
in addition, you should start now to write your html code in lowercase letters, and never make the bad habit of skipping end tags like the </p>.
另外,现在你应该开始用小写字母来书写你的html代码了,并且永远不要再像以前那样有跳过像</p>这样的结尾标记的坏习惯了。
happy coding!
陶醉于编码之中吧!

the most important differences:
两者最主要的不同:
xhtml elements must be properly nested
xhtml documents must be well-formed
tag names must be in lowercase
all xhtml elements must be closed
xhtml元素必须正确的嵌套
xhtml文档必须有良好的格式
标记的名字必须用小写字母
左右的xhtml元素都必须有关闭符

elements must be properly nested
元素(标记)必须被正确的嵌套
in html some elements can be improperly nested within each other like this:
在html中,有些标记能够非正确的相互嵌套,就像这样:

<b><i>this text is bold and italic</b></i>

in xhtml all elements must be properly nested within each other like this:
在xhtml中所有的标记必须被正确的嵌套,像这样:
<b><i>this text is bold and italic</i></b>

note: a common mistake in nested lists, is to forget that the inside list must be within an li element, like this:
注意:在列表嵌套的时候大家经常会犯一个错误,那就是忘记了插入的新的列表必须在一个<li>标记中,像这样
<ul>
  <li>coffee</li>
  <li>tea
    <ul>
      <li>black tea</li>
      <li>green tea</li>
    </ul>
  <li>milk</li>
</ul>

this is correct:
正确的写法
<ul>
  <li>coffee</li>
  <li>tea
    <ul>
      <li>black tea</li>
      <li>green tea</li>
    </ul>
  </li>
  <li>milk</li>
</ul>


notice that we have inserted a </li> tag after the </ul> tag in the "correct" code example.
在这段正确的代码示例中,注意到我们在</ul>之后加了一个</li>标记吗?

documents must be well-formed
文档必须格式良好
all xhtml elements must be nested within the <html> root element. all other elements can have sub (children) elements. sub elements must be in pairs and correctly nested within their parent element. the basic document structure is:
所有的xhtml标记必须被嵌套使用在<html>根标记之中。所有其他的标记能有自己的子标记。位于父标记之内的子标记也必须成对的而且正确的嵌套使用。一个网页的基本结构是这样:

<html>
<head> ... </head>
<body> ... </body>
</html>


tag names must be in lower case

本文关键:[XHTML Tutorial] 走向XHTML标准 (3)(Differences Between XHTML And HTML)
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top