下面是我正在制作的网站的 CSS 脚本:
@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}
HTML 文件如下
<!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>
它似乎不起作用...出了什么问题?
答案1
我想你的意思是这样的:
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;}
答案2
添加缺失的分号和标签
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;}