Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Below is my CSS script for a website I'm making:

@charset "utf-8";
/* CSS Document */
body{background-color:#3b5998; font-family:Tahoma, Geneva, sans-serif; color:red;}
link{color:red}
visited{color:purple}
hover{color:pink}
active{color:black}

Here's the HTML File

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Website</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

<body>
<table width="115" height="484" border="5">
  <tr>
    <td width="97"><a href="home.html" target="mainFrame">Home</a></td>
  </tr>
  <tr>
    <td><a href="flashchart.html" target="mainFrame">Flash</a></td>
  </tr>
  <tr>
    <td><a href="browsertest.html" target="mainFrame">Browser Test</a></td>
  </tr>
  <tr>
    <td>Upload</td>
  </tr>
  <tr>
    <td>Download</td>
  </tr>
  <tr>
    <td>Exit</td>
  </tr>
</table>
</body>
</html>

It doesn't seem to be working... What's wrong?

share|improve this question

closed as off topic by Darth Android, Daniel Beck Jun 25 '13 at 19:59

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What have you tried? Have you toyed around with it on JSFiddle? Have you looked at the debugger for your broswer to see how it's being parsed or if there are parsing errors? (You're missing most of your semicolons!) What specifically isn't working? –  Darth Android Jun 25 '13 at 19:44
    
I'm going to guess the body style works, but the link ones don't... –  Breakthrough Jun 25 '13 at 19:48
    
Yeah, the body is working but the links aren't, because I'm not sure how to format the link attributes in the CSS file –  Will Walker Jun 25 '13 at 19:49
4  
a:link, a:hover, etc. -- did you consider reading a tutorial? –  Daniel Beck Jun 25 '13 at 19:59
add comment

2 Answers

I think you mean this:

body{background-color:#3b5998; font-family:Tahoma, Geneva, sans-serif; color:red;}

a{color:red;}

a:visited{color:purple;}

a:hover{color:pink;}

a:active{color:black;}
share|improve this answer
    
No, I wanted to be able to import the CSS and have it apply to everything instead of having to add a tag to everything –  Will Walker Jun 25 '13 at 20:02
    
link, visited, hover and active are all selectors. They are active when the tag is in a certain state. They don't work if you don't say which tag they belong to (an anchor, I assume in this case). If you meant to use them as a class or an id, you should write '#visited' for an id or '.visited' for a class. –  Simon Verbeke Jun 25 '13 at 20:07
    
@SimonVerbeke 's answer works, add in the "a" (anchor / link) tags –  hanxue Jun 25 '13 at 20:22
add comment

Add the missing semicolons and the tags

body{background-color:#3b5998; font-family:Tahoma, Geneva, sans-serif; color:red;}

a:link{color:red;}

a:visited{color:purple;}

a:hover{color:pink;}

a:active{color:black;}
share|improve this answer
    
Ah, I placed the semicolons outside the brackets –  Will Walker Jun 25 '13 at 19:52
    
Still doesn't work –  Will Walker Jun 25 '13 at 19:52
    
Could you please post the HTML file as well? –  hanxue Jun 25 '13 at 19:56
    
@hanxue I edited the original question to include the HTML –  Canadian Luke Jun 25 '13 at 20:14
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.