html - 错误的 Css 选择器?

标签 html css http-status-code-404

我正在尝试让自定义 404 页面在我的网站上正常工作,但 CSS 无法正常工作。

CSS:

#404-container{
    text-align: center; 
}

.404-item{
    text-align: center; 
}

HTML:

<div id="404-container">
    <h1 class="404-item">404</h1>
    <h3 class="text-format-italic 404-item">The requested page could not be found</h3>
</div>

Firefox 控制台显示: 预期的选择器。由于错误的选择器而忽略了规则集。 两次。

最佳答案

啊哈!请永远不要以数字开头您的类(class)和 ID。这是最佳编程实践。您甚至永远不能以数字开头变量名。

将其更改为:

#four04 {
...
}

关于html - 错误的 Css 选择器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23026876/

相关文章:

javascript - CSS/JS - 包装元素的水平对齐

jquery - 如果为空,如何发布空的 <select .. multiple> HTML 元素?

html - 带有描述的响应图像

jquery - 新内容不继承具有无限滚动的父 div 的样式

python - 为什么我在 Flask 中收到 404 错误?

javascript - Node JS res.sendFile 不发送图像或目录

javascript - 由于ajax代码而导致404错误?

php - 一个提交按钮需要一种形式的输入字段,但其他按钮不需要?

html - 使图像适合 div 高度,但在保持纵横比的同时将水平内容居中

html - 如何在 Iframe 中启用对 Plotly-Dash 应用程序的响应?