WinterDev WinterDev - 4 months ago 8
CSS Question

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

https://jsfiddle.net/fuz5uqfb/

Doesn't worth there either.

Answer

You're using the wrong kind of quotation marks for your div id and 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