英文:
Cannot connect HTML file to CSS file which are both within the same folder
问题
VS Code将styles.css链接到链接标签中的href="styles.css"行,这使我完美地进入styles.css文件,所以我不确定为什么它没有链接。我尝试了很多来自互联网的方法,但没有一个有效。
英文:
This is an image of my workspace
This is an image of my CSS workspace
VS Code links the styles.css in the href="styles.css" line in the link tag and that leads me perfectly to the styles.css file so I'm unsure why it is not linking. I have tried a lot of things from the internet and nothing has worked.
答案1
得分: 3
尝试这个:
<link rel="stylesheet" type="text/css" href="styles.css">
英文:
Try this out:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<link rel="stylesheet" type="text/css" href="styles.css">
<!-- end snippet -->
答案2
得分: 3
应该是 -> 链接关系='stylesheet''
您错误地添加了额外的"s",应为"stylesheets"。
英文:
it should be -> link rel='stylesheet'
you have mistakenly added and extra "s" as "stylesheets"
答案3
得分: 3
所有建议删除末尾的 "s" 的答案都是正确的。
这里有一个链接 到 MDN 网页文档上关于 元素的信息。另外,不要为此感到不好,这只是任何人都可能犯的一个简单错误。
英文:
All the answers that say to remove the trailing s are correct.
Here's a link to the MDN web docs on the <link> element. p.s., don't feel bad about this, it's just a simple mistake that anyone can make.
答案4
得分: 2
将stylesheets
改为stylesheet
,删除s:
<link rel='stylesheet' href='styles.css' type='text/css' media='all'/>
英文:
Change stylesheets
into stylesheet
remove s
<link rel='stylesheet' href='styles.css' type='text/css' media='all'/>
答案5
得分: 1
更改您的文件路径
<link rel="stylesheet" type="text/css" href="./styles.css">
英文:
change your file path
<link rel="stylesheet" type="text/css" href="./styles.css">
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论