当前位置: 首页 > 网络学院 > 设计教程 > 设计理念 > XHTML和样式表
Briefly...
简述…
The web is changing. The web is actually changing everyday; different languages, algorithms, concepts, and ideas. It seemed as if, after learning HTML, I started hearing rumors of XHTML.
网络正在改变。事实上,网络每日都在发生变化;不同的语言、运算法则、概念和思维。正如你刚学完了HTML,似乎XHTML又隐约出现了。
Introduction to XHTML
XHTML简介
XHTML (eXtensible Hypertext Markup Language) is the redefinition in XML of HTML defined in SGML. XHTML1.0 became a W
XHTML(扩展超文本标记语言),它是通用标记语言标准下HTML在XML范畴内的定义。XHTML1.0于
The Ten Commandments of XHTML
XHTML的十诫
XHTML, as with anything and everything else in life, has rules. If there weren't any rules, where would the web be? (That's a whole other topic) So there are ten basic rules, as set out by the W
XHTML就像生活中的每一种事例一样,有其自己的准则。如果没有规则存在,那么何来网络?(这是另外一个话题了)因此,这里有十条针对Xhtml文档的准则,是由W
1. XHTML/XML shall be straightforwardly usable over the Internet.
XHTML/XML 应该在互联网中正当使用。
2. XHTML/XML shall support a wide variety of applications.
XHTML/XML 应该支持各种类型的应用程序。
3. XHTML/XML shall be compatible with SGML.
XHTML/XML 应该符合SGML [ 通用标记语言标准 ]
4. It shall be easy to write programs which process XHTML/XML documents.
对于执行XHTML/XML文档的程序书写应该非常简便
5. The number of optional features in XHTML/XML is to be kept to the absolute minimum, ideally zero.
XHTML/XML的附加功能应该绝对少,甚至没有。
6. XHTML/XML documents should be human-legible and reasonably clear.
XHTML/XML文档应该清晰易读。
7. The XHTML/XML design should be prepared quickly.
使用XHTML/XML进行设计应该具备方便快捷的特征。
8. The design of XHTML/XML shall be formal and concise.
XHTML/XML的设计应该正规并且简明。
9. XHTML/XML documents shall be easy to create.
XHTML/XML文档应该易于创建。
10. Terseness in XHTML/XML markup is of minimal importance.
是否需要简化XHTML/XML标记并不重要
These guidelines must be followed to create a well-formed, validated XHTML document.
创建形式优秀的、有效的XHTML文档必须遵循这些准则。
Basics You MUST Know
你必须知道的准则
In an XHTML document, there are a few things that must be a "standard". These are the rules that must be followed to correctly validate an XHTML document.
在XHTML文档内部,有些东西必须符合所谓的“标准”。如果你希望正确地创建有效的XHTML文档,那么,你必须遵循这些准则:
1. XHTML elements must be properly nested
XHTML元素必须被合理嵌套
2. XHTML documents must be well-formed
XHTML文档必须格式精确
3. Tag names must be in lowercase
用小写字母定义标签
4. All XHTML elements must be closed
所有的XHTML元素必须有结束符
1. Properly nested elements mean that you can't improperly nest within each other like this:
适当得嵌套元素意味着你不能像下面这样非法嵌套标签:
<i><b>This is bold, italic text</i></b> |
Which should actually be this to be properly nested:
应该像下面这样进行嵌套;
<i><b>This is bold, italic text</b></i> |
2. Well-formed documents are a must, and at the same time, can help you maintain a very good structure for not only XHTML, but programming too.
必须定义正确格式的文档,同时,它可以帮助你保持一个很好的结构,这不仅仅是对于XHTML来说的,同时也包括整段程序。
XHTML elements must be nested within the <html> root element. While the other elements can have child elements. Child elements must be in pairs and correctly nested within their parent element:
XHTML元素必须嵌套在<html>根元素中。然而,其它元素可以包含子元素。子元素必须成对出现,并且被正确地嵌套在它们的父元素中:
<div> |
3. Lowercase is a MUST !!! A lot of people, as I have seen, like to capitalize HTML code; this is a no-no in XHTML:
必须使用小写字母!!!我看到很多人喜欢用大写字母的形式来书写HTML代码,但这对于XHTML来说,绝对不行:
<A HREF="page.html">Link Here!</A> |
Now with XHTML you must have all code in lowercase, like so:
现在,只要是关于XHTML的代码,你必须全部使用小写字母的形式,就像下面这样:
<a href="page.html">Link Here!</a> |
4. All tags must be closed. Yes, even empty tags. Empty tags are the tags that, in HTML 4.0/4.01, that weren't required to be closed; break tag, horizontal rule tag, etc:
所有的标签必须有结束符。甚至是空标签。在HTML4.0 / 4.01中,空标签不要求有对应的结束标签,如:换行符<br>,段落标签<p>等等:
<p> |
In XHTML, you would find this code written as:
在XHTML中,你会发现上述代码应该以下面的形式书写:
<p> |
You must follow at least those four basic steps of XHTML in order to correctly validate you XHTML code.
你至少遵循上述的四条XHTML的基本准则,目的是为了正确地创建行之有效的XHTML代码。
XHTML...XML??
Anyone confused of where XML comes into the picture? Have you heard of XML and XHTML having something in common? Well, partly they do, and partly they don't. HUH?
XHTML…XML??
很多人都困惑,到底XML的那点引起了人们的注意?你听说过XML和XHTML的共同性吗?是的,它们有些内容类似,但有些却存在不同。嗯哼?
Let's get to the point. XHTML is a markup language written in XML; therefore, it is an XML application. So XML is a part of XHTML; that's why you must have complete, well-formed documents that validate entirely in order to call your document XHTML. The "Ten Commandments of XHTML" are the same as XML. The rules go hand in hand. So, a quick, non-technical description of XHTML is: XHTML is a hybrid between HTML and XML.
让我们切入主题吧。XHTML是一种用XML写成的标记语言;因此,它是一个XML应用程序。所以,XML是XHTML的一部分;这就是为什么你要很好的定义文档格式,是之整体有效的原因,只是为了能够称它为XHTML文档。“XHTML的十诫”与XML相同。规则互通。因此,XHTML简练而非专业的描述就是:XHTML是HTML和XML的混血儿。
XHTML uses three XML namespaces (used to qualify element and attributes names by associating them with namespaces identified by URI references. Namespaces prevent identically custom-named tags that may be used in different XML documents from being read the same way), which is like the three HTML 4.0 DTDs: Strict, Transitional, and Frameset.
XHTML使用三种XML