[英]external stylesheet CSS cannot be linked
I know this question has been asked before, because I already checked the forum. 我知道之前已经问过这个问题,因为我已经检查了论坛。 I cannot link my CSS to my HTML5 code.
我无法将CSS链接到HTML5代码。 I tried running my code in different browsers and cleaning the cache, but nothing worked.
我尝试在不同的浏览器中运行代码并清除缓存,但没有任何效果。
This is my code in HTML5: 这是我在HTML5中的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>External Style sheet </title>
<link rel="stylesheet" type="text/css" href="main.css"/>
</head>
<body>
<h1>Intro to CSS</h1>
<p> I'm blue</p>
<p>I can be any colour you want me to</p>
<p>I know you only wanna use me as a <br>example</br></p>
</body>
</html>
and my CSS 和我的CSS
p{
color:red;
}
h1{
background-color:yellow;
}
my code was ok, the problem was the way I was saving my CSS file, I was selecting the file type CSS(.css;*css,erb;.css,liquid) which made sense to me since I was trying to save a CSS file, but no. 我的代码还可以,问题是我保存CSS文件的方式,我选择的文件类型是CSS(.css; * css,erb; .css,liquid),因为我想保存一个CSS文件,但没有。 I only had to select the option all files and name it by myself as main.css.
我只需要选择所有文件选项,然后自己将其命名为main.css。 after that, my code run perfectly
之后,我的代码可以完美运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.