我正在使用 YSlow 来衡量整体页面性能。然而,CSS 在文档的 Head 部分声明,YSlow 仍然在文档的主体中找到 css 并建议将 CSS 放在顶部。可能是什么原因?
我没有在硬代码或内联样式中使用 CSS 属性,对于内联样式,我将类应用于该 div,如 <div class="header"></div>
.同样在 head 标签中有外部 CSS,如
<head>
<link rel="stylesheet" type="text/css" href="/css/menu.css" />
</head>
但是 YSlow 在 body 部分而不是头部找到 css。
最佳答案
你的问题不清楚,但我猜你可能有内嵌的 CSS 标签
有点像
<div style="float:left">asf asdf</div>
因此,您的文档可能是
<html>
<head>
<!--CSS declarations and title etc-->
</head>
<body>
<!--body code etc referencing the exteranl CSS sheets or the CSS declared in the header-->
<div style="color:#366;">These words are in this color</div>
</body>
</html>
关于html - 为什么 YSlow 在 Head 部分声明了 Css 仍然在 body 部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16440152/