HTML 类未被识别

标签 html css

<分区>

此代码按预期工作,但是当我尝试将 css 从影响整个 div 更改为仅影响类时,它似乎不起作用。我查看了语法,但似乎找不到任何错误。

* {
  margin: 0;
  font-family: "Helvetica”, sans-serif;

}

.test {
  background: #0d0e0d;
  height: 32px;
  width: 100vw;
}
<html>

<head>
  <title>WEBSITE</title>

</head>

<body>
  <div class=“test”></div>
</body>

</html>

最佳答案

您的 <div class=“test”></div> 中有一些奇怪的双引号.用常规双引号替换它们,您的代码可以正常工作:

<html>
        <head>
            <title>WEBSITE</title>
            <style>
                *{
                    margin: 0;
                    font-family: "Helvetica”, sans-serif;
                }
                .test {
                    background:#0d0e0d;
                    height:32px;
                    width:100vw;
                }
            </style>
        </head>
        <body>
            <div class="test"></div>
        </body>
    </html>

关于HTML 类未被识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46957500/

相关文章:

css - Bootstrap 导航栏中的定位元素

html - IE9 & IE10 rem 单位

html - 是否可以在 <select> 标签内创建表格?

html - 尝试让 Bootstrap 布局正常工作

Javascript 对话框自动高度无法正常工作

javascript - 使固定的 float 元素在 Firefox 和 Chrome 中平滑滚动

css - 如何垂直对齐列表?

html - 为什么只有 6 个 <h> 标签?

javascript - 在jquery中访问div中的属性

html - 在网站上设计 facebook iframe