是否允许在html中有几个标题标签?

5 html locale title

我正在查看标题标签http://www.w3schools.com/TAGS/tag_title.asp 如果我有几个具有不同lang ID的标题,那将是合法的吗?

Kon*_*lph 8

简单回答:没有.只有一个(正好一个)<title>元素是允许的.

来源:例如XHMTL 1.0 Strict DTD:

每个文档只需要一个标题.


Gum*_*mbo 7

不,HEAD只允许一个TITLE元素:

<!-- The TITLE element is not considered part of the flow of text.
       It should be displayed, for example as the page header or
       window title. Exactly one title is required per document.
    -->
<!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title -->
<!ATTLIST TITLE %i18n>
Run Code Online (Sandbox Code Playgroud)

是HTML 4.01文档类型定义的片段:

<!ENTITY % head.content "TITLE & BASE?">

<!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head -->
Run Code Online (Sandbox Code Playgroud)