【发布时间】:2018-02-11 17:16:52
【问题描述】:
环境
- Windows 8.1 64 位
- Visual Studio 代码 1.15.1
相关问题
问题
html 没有链接到 css
- css 中的类和 ID 不会显示在 html 中的 Intellisense 上。
- 当我将光标放在 html 中的类或 id 上并按 F12 跳转到 css 时,会弹出一个窗口并显示“未找到定义”。
但是,当我在浏览器中打开 html 时,网页显示得非常好。所以我的 Visual Studio Code 似乎有问题。
html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
<link rel="stylesheet" type="text/css" href="./css/style.css">
</head>
<body>
<div class="abc"></div>
<div id="xyz"></div>
</body>
</html>
css
.abc{
width: 100px;
height: 100px;
background: red;
}
#xyz{
width: 100px;
height: 100px;
background: blue;
}
文件
index.html
CSS
|
+---style.css
网页
我想知道如何解决这个问题。
编辑 17/9/3 19:03
谢谢你们的回答,伙计们。 以下方法无效。
href="../css/style.css"href="~/css/style.css"href="css/style.css"- 在标签中嵌入样式表(我想将 css 保存在单独的文件中)
【问题讨论】:
标签: html css windows visual-studio-code