无法识别HTML类 [英] HTML class not being recognized

查看:66
本文介绍了无法识别HTML类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

This code works as expected however when I try to change the css from affecting the div overall to just the class it doesn't seem to work. I've looked at the syntax but I can't seem to find any errors.

* {
  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>中有一些奇怪的双引号.用常规双引号替换它们,您的代码即可正常工作:

You have some wierd double quotes in your <div class="test"></div>. Replace them with regular double quotes and your code is working :

<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类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆