简体   繁体   English

为什么css不能使用这个div?

[英]Why doesn't css work with this div?

So I have a body here: 所以我在这里有一个身体:

 <body>
 <div id=”first”>
    <span class=”red”>This is a DIV Container</span>

    Or
    <br>
    This
</div>

And I have a style sheet with this 我有一个样式表

#first{
    background-color:red;
}

But the background color doesn't change. 但背景颜色不会改变。 I have no idea what I'm doing wrong... 我不知道我做错了什么......

Here's a jsfiddle with the code 这是代码的jsfiddle

https://jsfiddle.net/fuz5uqfb/ https://jsfiddle.net/fuz5uqfb/

Doesn't worth there either. 也不值得。

You're using the wrong kind of quotation marks for your div id and span class . 你的div id和span class使用了错误的引号。 It should be this: 它应该是这样的:

<body>
    <div id="first">
        <span class="red">This is a DIV Container</span>

        Or
        <br>
        This
    </div>
</body>

Updated Fiddle 更新小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM