Html 在body标签中加载外部css文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4957446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
load external css file in body tag
提问by Jinbom Heo
Possible Duplicate:
What's the difference if I put css file inside <head> or <body>?
usually, external css file loading code is put on header of html.
通常,外部 css 文件加载代码放在 html 的标题上。
<head>
...
<link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
...
</head>
but, sometime I should put my css loading code in body tag, I mean..
但是,有时我应该将我的 css 加载代码放在 body 标签中,我的意思是..
<body>
...
<link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
...
</body>
so my question is, is it okay to put my css loading code in body tag?
所以我的问题是,可以将我的 css 加载代码放在 body 标签中吗?
回答by Daan
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):
不,link
在 body 标签中放置元素是不行的。查看规范(链接到 HTML4.01 规范,但我相信所有版本的 HTML 都是如此):
“This element defines a link. Unlike
A
, it may only appear in theHEAD
section of a document, although it may appear any number of times.”
“这个元素定义了一个链接。与 不同
A
,它可能只出现在HEAD
文档的某个部分,尽管它可能出现多次。”