您现在的位置: 万盛学电脑网 >> 程序编程 >> 网络编程 >> 安卓开发 >> 正文

XHTML与HTML之间的区别

作者:佚名    责任编辑:admin    更新时间:2022-06-22

下面我们给大家介绍一下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了。希望大家继续关注我们的网站!