推荐的元元素?
为我的网站项目建立一个“基本框架”,我想知道哪些元元素是真正必要/推荐的?我特别想知道如何处理语言属性!?在下面的例子中,我认为……不必要地重复...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-language" content="en" />
<meta http-equiv="language" content="en" />
<title> Title </title>
<base href="http://www.mydomain.com" />
<meta name="charset" content="utf-8" />
<meta name="content-language" content="en" />
<meta name="language" content="en" />
<meta name="description" content="description" />
<meta name="keywords" content="keywords" />
</head>
PS“内容语言”=“语言”?
Setting up a "basic framework" for my website projects, I'm wondering which meta elements are really necessary/recommended? In particular, I'd like to know how to deal with the language attribute(s)!? In the following example, I think sth. is repeated unnecessarily...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-language" content="en" />
<meta http-equiv="language" content="en" />
<title> Title </title>
<base href="http://www.mydomain.com" />
<meta name="charset" content="utf-8" />
<meta name="content-language" content="en" />
<meta name="language" content="en" />
<meta name="description" content="description" />
<meta name="keywords" content="keywords" />
</head>
P.S. "content-language" = "language"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
绝对推荐
没用,浏览器只支持CSS。
没用,浏览器只支持JavaScript。
冗余
不存在,据我所知。
绝对推荐。
我想这取决于您希望相关链接如何工作。
看起来像错别字。
也许有用。
由于广泛滥用而被每个搜索引擎忽视。
Definitely recommended
Useless, browsers only support CSS.
Useless, browsers only support JavaScript.
Redundant to
<html lang="en">
Doesn't exist, AFAIK.
Definitely recommended.
Depends on how you want your relative links to work, I suppose.
Look like typo's.
Probably useful.
Ignored by every search engine due to widespread abuse.
将其用于 HTML 5:
这看起来错误:
对于 HTML 5 应该是这样:
这是设置字符集编码的新 HTML 5 方式。强烈建议还包括旧方法:
这些应该直接在开头的 head-tag 之后:
Use this for HTML 5:
This looks wrong:
should probably be this for HTML 5:
That is the new HTML 5-way of setting charset encoding. It is highly recommended to also include the old way:
These should be directly after the opening head-tag: