HTML <html> xmlns 属性


实例

一个简单的 XHTML 文档,带有最少的必需标签:

  1. <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Title of the document</title>
    </head>

    <body>
    The content of the document......
    </body>

    </html>
运行一下 »

浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持 xmlns 属性。

定义和用法

注意:在 XHTML 中,xmlns 属性是必需的。在 HTML 中,xmlns 属性是无效的。

xmlns 属性规定文档的 xml 命名空间。

然而,如果在 XHTML 文档中未使用 xmlns, http://w3.org 的 HTML 验证器也能正确识别文档。这是因为命名空间 "xmlns=http://www.w3.org/1999/xhtml" 是默认的,会自动添加到 <html> 标签。

语法

  1. <html xmlns="http://www.w3.org/1999/xhtml">

属性值

描述
http://www.w3.org/1999/xhtml 要使用的命名空间(XHTML 文档)。