Sign in to follow this  
programering

[web] CSS not working.

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
Guest Anonymous Poster
do you need a semicolon at the after the color?

Share this post


Link to post
Share on other sites
Do you override the styles at a lower level? Mor especific selector? Inline syles? style attributes? User-defined style sheets? The "!important" directive?

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
Quote:
Original post by Mathachew
Also, how can you read your CSS when it's all crammed together like that?!

That's not so hard for me.

*** Source Snippet Removed ***
I copied and pasted your code in, and it worked.
Thanks.

Share this post


Link to post
Share on other sites

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