简体   繁体   English

CSS 样式表未应用于 html,但已加载

[英]CSS Stylesheet not being applied to html, but is loaded

I decided to test my webserver and it's working, but CSS is not being applied.我决定测试我的网络服务器并且它正在工作,但是 CSS 没有被应用。 I can see in my browser, that files are loaded, but they're not effecting html.我可以在浏览器中看到文件已加载,但它们不影响 html。 CSS is also working fine, if I make tag in head, and defines color: red; CSS 也可以正常工作,如果我在头部制作标签并定义颜色:红色; there.那里。 You can check the site by yourself: http://worldsmp.net/index.html您可以自行查看网站: http://worldsmp.net/index.html

DevTools Sources开发工具源

DevTools Computed Body Style DevTools 计算体样式

Server Directory服务器目录

index.html:索引.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
    hi
</body>
</html>

style.css:样式.css:

body {
    color: red;
}

I checked your code is working on online compiler.我检查了您的代码正在使用在线编译器。

When i did validation of your code i got this error.当我验证您的代码时,我收到了这个错误。

Error: A document must not include both a meta element with an http-equiv attribute whose value is content-type, and a meta element with a charset attribute.错误:文档不得同时包含具有 http-equiv 属性且值为 content-type 的元元素和具有 charset 属性的元元素。 From line 8, column 5;从第 8 行第 5 列开始; to line 8, column 73 itle>↩ ↩ < Error: A meta element with an http-equiv attribute whose value is X-UA-Compatible must have a content attribute with the value IE=edge.到第 8 行,第 73 列 itle>↩ ↩ < 错误:具有值为 X-UA-Compatible 的 http-equiv 属性的元元素必须具有值为 IE=edge 的内容属性。 From line 9, column 5;从第 9 行第 5 列开始; to line 9, column 56 8" />↩ ↩ <到第 9 行第 56 列 8" />↩ ↩ <

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM