在下面输入图像描述我的代码运行良好,但当我在浏览器中预览html文件时,没有任何样式显示。 当我在Chrome dev工具中检查该元素时,它显示它仍然试图只是访问“style.css”,而不是我在其中编写的路径。 我清除了浏览器缓存,我关闭并重新打开了页面,刷新了它,保存了文件并关闭了IDE等等,我做错了什么?
null
body {
background: -webkit-linear-gradient(-45deg,#FFFED4,#FFEEFF)
}
h1, p, h3{
font-family: Arial;
color: black;
}
h1 {
font-size: 60px;
text-align: center;
}
p {
font-size: 25px;
text-align: center;
}
img {
display: block;
margin-left:auto;
margin-right: auto;
width: 50%;
}
h3 {
font-size: 25px;
font-family: Helvetica;
position: relative;
bottom: 0px;
}
<!DOCTYPE html>
<html>
<head>
<title>We Apologize</title>
<link rel="stylesheet" type="text/css" href="./resources/css/style.css">
<link rel="icon" type="image/gif/png" href="./resources/img/Brighton-McFarlane13.png">
</head>
<body>
<main>
<h1>We apologize</h1>
<p>The site is under construction right now, but we are doing our best to bring it to life! Check back in a few weeks to see the final product!</p>
<img src="https://i.imgur.com/YjMR0E6.jpg">
</main>
<article>
<p>Soon this site will be a portfolio, shop, and forum for the <a href="https://www.youtube.com/channel/UCLxxUr3dwkzNkIUvFv84k4w/" target="_blank">Brighton McFarlane YouTube Channel!</a></p>
<img src=./resources/img/Brighton-McFarlane12.png>
<h3>Thanks for stopping by!</h3>
</article>
</body>
<html>
null
听起来你的相对路径有问题。 我无法看到文件目录是如何设置的,但请尝试href=“resources/css/style.css”
如果它仍然不工作,你需要向上移动一个文件夹。 href=“。。/resources/css/style.css”
希望这有用!