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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.