[英]My .css will not link to .html
I know this question has been asked alot as I've compared multiple threads to my own code, but I'm still stumped.我知道这个问题已经被问了很多,因为我已经将多个线程与我自己的代码进行了比较,但我仍然被难住了。
My code is as follows:我的代码如下:
<!DOCTYPE html>
<html>
<head>
<title>R H Y T H M /// U N I T E D</title>
<link href=“style.css” type=“text/css” rel=“stylesheet”>
</head>
<body>
<h1>RHYTHM UNITED</h1>
<a href=“main.html”>Enter</a>
</body>
</html>
****CSS**separate file called style.css***
h1 {
color: #fa1834;
font-family: sans-serif;
}
body {
background-color: aqua;
}
Both files within a folder called "Website" on my desktop.我桌面上名为“网站”的文件夹中的两个文件。
My attempts at fixing this code are as follows: -Adding a / before the > in the link tag.我修复此代码的尝试如下: - 在链接标记中的 > 之前添加 /。
-changing to href="/style.css", then I tried href="website/style.css" - 更改为 href="/style.css",然后我尝试了 href="website/style.css"
Going into chrome->developer I can see that the .css is not linking at all.进入 chrome->developer 我可以看到 .css 根本没有链接。 So my .css code isn't the issue, at least not yet.
所以我的 .css 代码不是问题,至少现在不是。
Thanks!谢谢!
What text/code editor are you using?您使用的是什么文本/代码编辑器?
You double-quotes seem to be causing the issue.您的双引号似乎是导致问题的原因。 I created your setup locally myself and experienced the same issue - until I changed the quotes - you can even use single quotes for the sake of testing.
我自己在本地创建了您的设置并遇到了同样的问题 - 在我更改引号之前 - 您甚至可以使用单引号进行测试。
For the sake of learning - use a 'decent' text editor like 'sublime text', or notepad++ (if on windows).为了学习 - 使用“像样的”文本编辑器,如“sublime text”或记事本++(如果在 Windows 上)。
Copy and try this HTML复制并尝试此 HTML
<!DOCTYPE html>
<html>
<head>
<title>R H Y T H M /// U N I T E D</title>
<link href='style.css' type='text/css' rel='stylesheet'>
</head>
<body>
<h1>RHYTHM UNITED</h1>
<a href='main.html'>Enter</a>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.