Jennifer He
Jennifer He

Reputation: 75

Applying css to specific <a> tag

I apply css to a specific tag, but it's not working. The following is my code: HTML:

<div id="content">
        <div class="fixedwidth">
            <p><span class="date">2 April 2014 Last update at 15:23</p>
            <h1>Norwich 'explosion': Two people dead</h1>
            <img class="headlineimg" src="pictures/headline.jpg" />
            <div class="newsitem">
                <p>Two people have died in a suspected explosion at an industrial estate in Norwich.</p>
                <p><a href="">Protest shuts Heathrow Airport runway</a></p>
                <p><a href="">Harman 'happy to be overruled' on cuts</a></p>
                <p><a href="">Get poor pupils 'into schools early'</a></p>
                <p><a href="">Bird flu confirmed at Lancashire farm</a></p>

            </div>
        </div>
    </div>

css:

.newsitem a{
            color:#1F4F82
            text-decoration:none;
        }

.newsitem a:hover{
            text-decoration:underline;
        }

Can anyone tell me what is wrong with my code? Thanks.

Upvotes: 0

Views: 15305

Answers (2)

It is quite working over there. I think there is something you are not doing right either with your code or possibly a conflict.

Likely way to solve this problem i. Right-Click on the element and click inspect element, then try to edit it using the css selector box on the right side of the your screen ii. Add !important to your code as show below:

.newsitem a{
            color:#000000 !important;
            text-decoration:none;
        }

.newsitem a:hover{
            text-decoration:none !important;
        }

Hope it works.

Upvotes: 2

nthall
nthall

Reputation: 2915

in your first declaration, you're missing a semicolon after setting the color

Upvotes: 4

Related Questions