Sign in to follow this  

[web] CSS not working.

This topic is 4050 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The color specification for link, hover and active aren't working, it only shows the properties/color for visted links with both FireFox and IE. How can I get it to work? Default.css:
body    {background-color:#000000}
a:link  {text-decoration:none;font-weight:bold;color:#ff0000}
a:hover {text-decoration:none;font-weight:bold;color:#000000}
a:active {text-decoration:none;font-weight:bold;color:#000000}
a:visited {text-decoration:none;font-weight:bold;color:#ff0000}

Share this post


Link to post
Share on other sites
The issue isn't using the wrong color (the current color specifications are fine), rather it's the order in which your attributes appear:

Pseudo Classes
See it in action

Also, how can you read your CSS when it's all crammed together like that?!


/* Much more legible and easier to spot an error */
body {
background-color: #000;
}
a:link {
text-decoration: none;
font-weight: bold;
color: #f00;
}
a:visited {
text-decoration: none;
font-weight: bold;
color: #f00;
}
a:hover {
text-decoration: none;
font-weight: bold;
color: #000;
}
a:active {
text-decoration: none;
font-weight: bold;
color: #000;
}



Also, while you can leave the last attribute without a semicolon, I'd consider it a bad practice. Why not just take that extra keystroke and put it? Makes your CSS look more organized and consistent.

Share this post


Link to post
Share on other sites

This topic is 4050 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this