Jump to content
  • Advertisement
Sign in to follow this  
programering

[web] CSS not working.

This topic is 4268 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!