在下面的HTML/CSS中,爲什麼鏈接顏色是綠色而不是藍色,即爲什麼「p.description」重寫「#nav」但「p.description a」不重寫「#nav a」?爲什麼超鏈接樣式不能在CSS中級聯?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style type="text/css">
#nav {
color: black;
}
#nav a {
color: green;
}
p.description {
color:red;
}
p.description a {
color:blue;
}
</style>
</head>
<body>
<div id="nav">
<p class="description">This is a test and <a href="#">this is a link</a>.</p>
</div>
</body>
</html>
相關:http://stackoverflow.com/questions/2809024/points-in-css-specificity – 2010-10-08 15:40:31