Jump to content

A small css problem


lional

Recommended Posts

I am writing a php script with several <a> tags. I need to format one set on the left hand side of the page but not the rest. I have used the following css code, but it formats all of the <a> tags.

Is there a way around this?

 

Here is my css code:

a:link {
background-color: #fac601;
color: #922828;
font-weight: bold;
width="200";
}
a:visited {
background-color: #fac601;
color: #922828;
font-weight: bold;
width="200";
}
a:hover {
background-color: #922828;
color: #fac601;
font-weight: bold;
width="200";
}
a:active {
background-color: #922828;
color: #fac601;
font-weight: bold;
width="200";
}

 

Thanks

 

Lional

Link to comment
https://forums.phpfreaks.com/topic/71781-a-small-css-problem/
Share on other sites

assuming that all the tags on the 'left hand side are in a separate div to others...

 

give that div an id (eg id="leftpanel")

 

then in css

 

div#leftpanel a,

div#leftpanel a:link,

div#leftpanel a:visited

{

....

}

 

div#leftpanel a,

div#leftpanel a:hover,

div#leftpanel a:active

{

....

}

 

this will only aply the style to those elements make sure you don't redeclare a selector after this that will impace on the style (i.e. don't declare another set of a styles without another selector before them).

Link to comment
https://forums.phpfreaks.com/topic/71781-a-small-css-problem/#findComment-361529
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.