David
David

Reputation: 4518

CSS Styling for 'a' (anchor tag) is not working

Let's say I have some hyperlink but class and id of it are already used by other scripts. So how can I add some css to them ? I tried 2 things.

<div class='some_css'>
<a href='".$_SERVER['PHP_SELF']."' class='used' id='used1'>link1</a>
<a href='".$_SERVER['PHP_SELF']."' class='used' id='used2'>link2</a>
</div>

///css file
.some_css:a
{
color:#456e9c;
}

Another try

<span class='some_css'><a href='".$_SERVER['PHP_SELF']."' class='used' id='used1'>link1</a></span>
<span class='some_css'><a href='".$_SERVER['PHP_SELF']."' class='used' id='used2'>link2</a></span>

///css file   
.some_css:a
{
color:#456e9c;
}

Both are wrong..... I know I do something wrong, please help

Upvotes: 0

Views: 2253

Answers (5)

Mp0int
Mp0int

Reputation: 18737

a href='".$_SERVER['PHP_SELF']."' class='used other_class' id='used1'>link1</a>

So you can define more than one class to an element with using space as a seperator...

Upvotes: 0

Julian
Julian

Reputation: 2061

Target a contained inside .some_css

.some_css a {
  color:#456e9c;
}

Upvotes: 1

Per H
Per H

Reputation: 1542

.some_css a {

}

(in other words, lose the ':')

Upvotes: 1

Gerben
Gerben

Reputation: 16825

replace the colon (':') by a space.

Upvotes: 3

BoltClock
BoltClock

Reputation: 724452

Use a space, not a colon (:). Colons are meant for stuff like pseudo-classes/elements, and properties.

.some_css a
{
color:#456e9c;
}

Upvotes: 7

Related Questions