Julián Abal
Julián Abal

Reputation: 45

CSS Not applying to a particular element (DIV)

So this would be my html:

    <body>
        <section id="info">
            <div class="status">

...

I am trying to style the div.status through my css file attached to the html file and the line begins like this

body section#info > div.status { ... }

I am not using any css3 properties and the element is not applying ANY of them. I am able to style an inside element though, using the straight-child ">" symbol. To do it, I just copied the line before and completed the path to the element.

I'd really appreciate some thoughts, thanks!

Upvotes: 0

Views: 1666

Answers (4)

Lee
Lee

Reputation: 4323

In your CSS file, you haven't properly closed the previous line 21, which was breaking the file causing everything beyond line 21 to be ignored.

div.map > .countries > #country

Should be

div.map > .countries > #country {}

(Or whatever you intend to put in that declaration, but just try making it empty for now and seeing if that solves the issue)

Upvotes: 0

Suresh Karia
Suresh Karia

Reputation: 18218

It is working just check how css is embedded into your html!

body section#info > div.status { color: blue; }

See Demo Here

I think the problem is in embedding the css into your file!

straight write between your head element like this

<head>
    <style>
        body section#info > div.status { color: blue; }
    </style>
</head>

Or if it is separate css file! make sure path is correct!

<head>
    <link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

Upvotes: 0

DifferentPseudonym
DifferentPseudonym

Reputation: 1024

Why you not just try to use

.status
{...}

But yours is working too.

Upvotes: 1

Imamadmad
Imamadmad

Reputation: 77

Simply using

div.status { ... }
should work fine, or
section#info div.status { ... }
because as long as there is no interference with other elements of the same class which need to be styled differently (in which case you should probably be using a separate class), you don't need to be too specific, and the extra code increases the likelihood of syntax errors to creep into your work, breaking it. If you're still having problems, then can you please give a sample of work with a little more info in it so we can see if the problem is coming from elsewhere?

Upvotes: 0

Related Questions