在主体标记中加载外部 css 文件

可能的复制品:
如果我把 css 文件放在 < head > 或 < body > ? 中,有什么区别呢

通常,外部的 css 文件加载代码放在 html 的头部。

<head>


...
<link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
...


</head>

但是,有时候我应该把我的 css 加载代码放在 body 标签中, 我是说..。

<body>
...
<link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
...
</body>

所以我的问题是, 可以把我的 CSS 加载代码放在 body 标签里吗?

195433 次浏览

No, it is not okay to put a link element in the body tag. See the specification (links to the HTML4.01 specs, but I believe it is true for all versions of HTML):

“This element defines a link. Unlike A, it may only appear in the HEAD section of a document, although it may appear any number of times.”