0

我已经制作了一个我想用样式链接制作的网站。我不想为所有链接设置通用样式。我想为他们开设不同的课程。

我已经尝试在测试仪页面上执行此操作,但无法使其正常工作。这是代码:

<!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>Untitled Document</title>
<style type="text/css">
test: link {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1em;
    color: #C00;
}
test: hover {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1em;
    color: #6F0;
}
test: active {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1em;
    color: #90F;
}
test: visited {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1em;
    color: #FF0;
}
.test {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1em;
    line-height: 1em;
    color: #999;
}
</style>
</head>

<body>
Emily

<p>sdlkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjlsdkf
sdlkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjlsdkf
sdlkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjlsdkf
sdlkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjlsdkf

  <span class="test"><a href="http://www.ehow.com/how_2080242_style-link-css.html">rose</a> 

  <a href="http://www.ehow.com/how_2080242_style-link-css.html"> daisy</a> 

  <a href="http://www.ehow.com/how_2080242_style-link-css.html">tulip</a> 

  <a href="http://www.ehow.com/how_2080242_style-link-css.html"> cactus</a> </span>
<p>ldkfjsldkfjlsdkfsdlkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjs    ldkfjsldkfjlsdkfsdlkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsldkfjsld



</body>
</html>

有人可以告诉我我做错了什么。谢谢!

4

1 回答 1

3

这里很少出错。测试是一个类,这意味着它前面需要一个句点 - .test。其次,链接在测试范围内。因此,您应该必须.test a在测试跨度中指出一个链接。最后,您需要将链接标签放在a分号之前。没有空间。

http://jsfiddle.net/vPBCB/

.test a:link {
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1em;
    color: #C00;
}
于 2013-01-29T02:17:57.187 回答