主頁(yè) > 知識(shí)庫(kù) > 干凈的XHTML語(yǔ)法

干凈的XHTML語(yǔ)法

熱門(mén)標(biāo)簽:威海語(yǔ)音外呼系統(tǒng)平臺(tái) 江西ai電銷(xiāo)機(jī)器人如何 中國(guó)地圖標(biāo)注城市的 地圖標(biāo)注沿海城市房?jī)r(jià) 高德地圖標(biāo)注廁所 地圖標(biāo)注員工作內(nèi)容 西安金倫外呼系統(tǒng) 通遼地圖標(biāo)注app 智能語(yǔ)音電銷(xiāo)機(jī)器人客戶端
Writing XHTML demands a clean HTML syntax.
寫(xiě)XHTML要求使用干凈的HTML語(yǔ)法
--------------------------------------------------------------------------------
Some More XHTML Syntax Rules:
更多XHTML語(yǔ)法規(guī)則:
Attribute names must be in lower case
屬性名稱必須為小寫(xiě)
Attribute values must be quoted
屬性值使用雙引號(hào)
Attribute minimization is forbidden
屬性簡(jiǎn)寫(xiě)是不允許的
The id attribute replaces the name attribute
用id屬性來(lái)替代name屬性
The XHTML DTD defines mandatory elements
XHTML DTD定義強(qiáng)制元素
--------------------------------------------------------------------------------
Attribute Names Must Be In Lower Case
屬性名稱必須為小寫(xiě)
This is wrong:
這是錯(cuò)誤的:
<table WIDTH="100%">This is correct:
這是正確的:
<table width="100%">
--------------------------------------------------------------------------------
Attribute Values Must Be Quoted
屬性值必須帶上雙引號(hào)
This is wrong:
這是錯(cuò)誤的:
<table width=100%>This is correct:
這是正確的:
<table width="100%">
--------------------------------------------------------------------------------
Attribute Minimization Is Forbidden
不允許屬性簡(jiǎn)寫(xiě)
This is wrong:
這是錯(cuò)誤的:
<input checked>
<input readonly>
<input disabled>
<option selected>
<frame noresize>This is correct:
正確的是這樣:
<input checked="checked" />
<input readonly="readonly" />
<input disabled="disabled" />
<option selected="selected" />
<frame noresize="noresize" />Here is a list of the minimized attributes in HTML and how they should be written in XHTML:
這是在HTML中簡(jiǎn)寫(xiě)的屬性和其在XHTML中應(yīng)該怎樣書(shū)寫(xiě)的列表:
HTML XHTML
compact compact="compact"
checked checked="checked"
declare declare="declare"
readonly readonly="readonly"
disabled disabled="disabled"
selected selected="selected"
defer defer="defer"
ismap ismap="ismap"
nohref nohref="nohref"
noshade noshade="noshade"
nowrap nowrap="nowrap"
multiple multiple="multiple"
noresize noresize="noresize"

--------------------------------------------------------------------------------
The id Attribute Replaces The name Attribute
id屬性替換name屬性
HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the name attribute is deprecated. Use id instead.
對(duì)于a, applet, frame, iframe, img和map,HTML 4.01中定義了一個(gè)name屬性,在XHTML中是不贊成這樣做的,使用id來(lái)代替。
This is wrong:
這是錯(cuò)誤的:
<img src="picture.gif" name="picture1" />This is correct:
這是正確的:
<img src="picture.gif" id="picture1" />Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:
注意:為了版本比較低的瀏覽器,你應(yīng)該同時(shí)使用name和id屬性,并使它們兩個(gè)的值相同的,像這樣:
<img src="picture.gif" id="picture1" name="picture1" />IMPORTANT Compatibility Note:
兼容性注意點(diǎn):
To make your XHTML compatible with today''s browsers, you should add an extra space before the "/" symbol.
讓你的XHTML兼容當(dāng)前的瀏覽器你應(yīng)該在/標(biāo)記前添加空格

--------------------------------------------------------------------------------
The Lang Attribute
Lang 屬性
The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element.
lang屬性可以應(yīng)用于幾乎所有的XHTML元素。它指定了元素中內(nèi)容的語(yǔ)言
If you use the lang attribute in an element, you must add the xml:lang attribute, like this:
如果你像在一個(gè)元素中應(yīng)用lang屬性,你必須加上x(chóng)ml:lang屬性,像這樣:
<div lang="no" xml:lang="no">Heia Norge!</div>
--------------------------------------------------------------------------------
Mandatory XHTML Elements
強(qiáng)制XHTML元素
All XHTML documents must have a DOCTYPE declaration. The html, head and body elements must be present, and the title must be present inside the head element.
所有的XHTML文檔都必須有一個(gè)DOCTYPE聲名。html、head和body元素必須出現(xiàn),并且title必須在head元素里
This is a minimum XHTML document template:
這是一個(gè)極小的XHTML文檔模板
<!DOCTYPE Doctype goes here>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head><body>
Body text goes here
</body></html>Note: The DOCTYPE declaration is not a part of the XHTML document itself. It is not an XHTML element, and it should not have a closing tag.
注意:DOCTYPE聲明并不是XHTML文檔自身的一部分。它也不是XHTML元素,它不該有關(guān)閉標(biāo)簽。
Note: The xmlns attribute inside the <html> tag is required in XHTML. However, the validator on w3.org does not complain when this attribute is missing in an XHTML document. This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed value and will be added to the <html> tag even if you do not include it.
注意:XHTML文檔要求xmlns屬性出現(xiàn)在html標(biāo)簽中。然而,w3.org的校驗(yàn)器不會(huì)由于這個(gè)屬性沒(méi)有出現(xiàn)在你的XHTML文檔中而報(bào)告錯(cuò)誤。這是因?yàn)?quot;xmlns=http://www.w3.org/1999/xhtml"是一個(gè)固定的值,即使你的文檔里沒(méi)有包含它,它也會(huì)自動(dòng)加上的。
You will learn more about the XHTML document type definition in the next chapter

標(biāo)簽:崇左 青海 北海 營(yíng)口 眉山 阜陽(yáng) 河池 晉中

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《干凈的XHTML語(yǔ)法》,本文關(guān)鍵詞  干凈,的,XHTML,語(yǔ)法,干凈,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《干凈的XHTML語(yǔ)法》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于干凈的XHTML語(yǔ)法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章