为什么即使我清除了缓存,我的styles.css也没有加载



我在这里为我的页面编写了新的CSS,但它不会更新。因此,通过访问Chrome:settings/clearBrowsingData清除了我在谷歌Chrome上的缓存,你知道正常的东西,但它仍然不会更新。所以我用我的iPad只是想看看我电脑的一半是否是侥幸,但它也没有更新。所以我来了。有什么建议吗?这是我的styles.css和index.html:

样式:

* {
margin: 0;
padding: 0;
}
html {
font-size: 10px;
scroll-behavior: smooth;
font-family: "Nunito", sans-serif;
}
a {
text-decoration: none;
}
.title {
text-align: center;
padding-top: 20rem;
}
.title h1 {
font-size: 3.5rem;
text-align: center;
}
.title h3 {
font-size: 2rem;
padding-bottom: 2rem;
}
.title a {
text-transform: uppercase;
color: #fff;
background: #333;
padding: 1rem 2.5rem;
border-radius: 8px;
font-size: 1.3rem;
transition: color 650ms, background 650ms;
}
.title a:hover {
color: #555;
background: #eee;
}
@media only screen and (min-width: 768px) {
.title {
padding-top: 30rem;
}
.title h1 {
font-size: 8rem;
}
.title h3 {
font-size: 4.5rem;
}
.title a {
font-size: 2.5rem;
padding: 1.5rem 3rem;
}
}
@media only screen and (min-width: 1000px) {
.title {
padding-top: 25rem;
}
.title h1 {
font-size: 5rem;
}
.title h3 {
font-size: 3.5rem;
}
.title a {
font-size: 1.3rem;
padding: 1rem 2.5rem;
}
}

HTML

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet">
<link href="styles.css" rel="stylesheet" type="text/css">
<title>Error 404</title>
<link rel="icon" href="logo.png">
</head>
<body>
<div class="title">
<h1>Not Found</h1>
<h3>This page either does not exist or<br> you don't have permission to view it. <br>(Error: 404)</h3>
<a href="http://balloosions.com/">Back to Home</a>
</div>
</body>
</html>

您可以调用相同css文件的不同版本,如下所示:

<link href="styles.css?v=1" rel="stylesheet" type="text/css">

因为您在没有启动/的情况下将名称命名为styles.css,所以该文件将从与html文件相同的目录下载。在您的404文件夹中没有styles.css。因此,将style.css更改为/styles.css,它就会起作用。

最新更新