对 CSS 的更改未显示在 404 页面上



CSS 文件所做的更改不会应用于 404 错误页面

编辑:有问题的页面:https://hinnahackers.no/404/

蝙蝠的权利:这不是一个相对路径问题。我在标题中指定了一个基本 href,如下所示:

<base href="https://hinnahackers.no/">

我知道这是有效的,因为我的 404 页面加载了我的 CSS 文件中的一些样式,但没有加载新添加的类。

这也不是强制刷新CSS文件的问题,因为我已经在做样式.css?v=X:

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

但它似乎在我的 404 页面上不起作用。CSS在其他页面上更新,如index.php。

这是我的 .htaccess 文件,如果用户输入无效的 url.php我用它来将用户重定向到 404:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
#Rewrite everything to https
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#404 redirect
ErrorDocument 404 /404.php

在我的 CSS 中,我添加了以下类:

.404__heading {
font-size: 2em;
color: #fff;
line-height: 1.5;
}
.404__error {
margin-top: 50px;
font-size: 2em;
color: #ea0548;
line-height: 1.5;
}
.404__entry__container {
margin-top: 50px;
}
.404__entry__wrap {
position: relative;
display: inline-block;
height: 20px;
width: 21px;
vertical-align: middle;
margin-right: 12px;
}
.404__entry__wrap a {
display: inline-block;
vertical-align: middle;
color: #fff;
font-size: 2em;
text-decoration: none;
}
.404__entry__top__dot {
position: absolute;
top: 0;
left: 0;
background: #ff6600;
height: 7px;
width: 7px;
}
.404__entry__middle__dot {
position: absolute;
top: 10px;
left: 7px;
background: #ff6600;
height: 6px;
width: 7px;
transform: translateY(-50%);
}
.404__entry__bottom__dot {
position: absolute;
bottom: 0;
left: 0;
background: #ff6600;
height: 7px;
width: 7px;
}
.404__entry__caret {
display: inline-block;
vertical-align: middle;
background: #fff;
height: 35px;
width: 18px;
margin-bottom: -5px;
}
.404__heading::selection,
.404__error::selection,
.404__entry__wrap::selection,
.404__entry__wrap a::selection {
text-shadow: none;
background: rgba(255, 255, 255, 0.3);
color: #fff;
}

但是它们在我的404.php页面上没有得到认可。所以现在我直接在我的 404 页面中添加了样式等。我对正在发生的事情完全不知所措。我已经在谷歌上搜索了几个小时,但找不到解决方案。

CSS 类不能以数字开头。

你似乎有CSS错误。 当您使用此工具检查样式.css文件的 CSS 时:http://csslint.net/您将看到 34 个错误。也许这就是导致您的问题的原因?

最新更新