萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 安卓開發 >> XHTML與HTML之間的區別

XHTML與HTML之間的區別

下面我們給大家介紹一下HTML吧!希望大家可以在這裡學習!

如何為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  so bringing your code up to  standards is a very good start Our complete HTML  reference can help you with that

其間去做一些重要的事情來為它做准備就像你可以從這教程學到東西一樣XHTML與HTML相差不多所以把你的代碼改寫成符合HTML標准是一種非常好的開始我們完整的HTML參考可以幫助你解決這個問題

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

另外現在你應該開始用小寫字母來書寫你的HTML代碼並且永遠不要再像以前那樣有跳過像

這樣的結尾標簽的壞習慣

Happy coding!

快樂的編碼!

The Most Important Differences:

非常重要的區別

XHTML elements must be properly nested

XHTML元素必須合理嵌套

XHTML documents must be wellformed

XHTML文檔必須格式正確

Tag names must be in lowercase

標簽名稱必須是小寫

All XHTML elements must be closed

所有XHTML元素必須關閉

Elements Must Be Properly Nested

元素必須合理嵌套

In HTML some elements can be improperly nested within each other like this:

在HTML中一些元素可以不使用正確的相互嵌套像這樣

This text is bold and italicIn XHTML all elements must be properly nested within each other like this:

在XHTML所有元素必須合理的相互嵌套像這樣

This text is bold and italicNote: A common mistake in nested lists is to forget that the inside list must be within a li element like this:

注意在列表嵌套的時候經常會犯一個錯誤就是忘記了在列表中插入的新列表必須在一個

標記中像這樣

Coffee

Tea

Black tea

Green tea

Milk

This is correct:

這才是正確的

Coffee

Tea

Black tea

Green tea

Milk

Notice that we have inserted a

tag after the tag in the correctcode example

在這段正確的代碼示例中要注意在之後加了一個標簽

Documents Must Be Wellformed

文檔格式必須合格

All XHTML elements must be nested within the 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標記必須被嵌套使用在 根標簽之中所有其他的標簽可以有自己的子標簽位於父標簽之內的子標簽也必須成對且正確的嵌套使用一個網頁的基本結構

Tag Names Must Be In Lower Case

標簽名稱必須是小寫

This is because XHTML documents are XML applications XML is casesensitiveTags like

and

are interpreted as different tags

這是因為XHTML文檔是XML應用程序XML是區分大小寫的像

會被認為是兩種不同的標簽

This is wrong:

這是錯誤的

This is a paragraph

This is correct:

這是正確的

Tag Names Must Be In Lower Case

標簽名稱必須是小寫

This is because XHTML documents are XML applications XML is casesensitiveTags like

and

are interpreted as different tags

這是因為XHTML文檔是XML應用程序XML是區分大小寫的像

會被認為是兩種不同的標簽

This is wrong:

這是錯誤的

This is a paragraph

This is correct:

這是正確的

This is a paragraph

All XHTML Elements Must Be Closed

所有的XHTML元素必須關閉

Nonempty elements must have an end tag

非空元素必須有關閉標簽

This is wrong:

這是錯誤的

This is a paragraph

This is another paragraphThis is correct:

正確是這樣

This is a paragraph

This is another paragraph

Empty Elements Must Also Be Closed

空的元素也必須關閉

Empty elements must either have an end tag or the start tag must end with />

空的元素也必須有一個結束標簽或者開始標簽用/>結束

This is wrong:

這是錯誤的

This is a break

Here comes a horizontal rule:

Heres an image his is correct:

這是正確的

This is a break

Here comes a horizontal rule:

Heres an image

IMPORTANT Compatibility Note:

注意兼容性的關鍵

To make your XHTML compatible with todays browsers you should add an extra space before the / symbol like this:  and this:

為了使你的XHTML能夠兼容現在的浏覽器你必須在/符號之前加一個特殊的空格就像這樣和這樣

以上就是我們給大家介紹的HTML了。希望大家繼續關注我們的網站!

copyright © 萬盛學電腦網 all rights reserved