为什么要用a:link{color:red;}而不是用a{color:red;
因为a{color:red;}不仅会应用于为访问的链接,还会应用到目标锚
<a name="red">red</a> 即非链接,因为没有它href属性。
伪类的顺序很重要,link-visited-focus-hover-active
p:frist-child{font-weight:bold;}
将作为某元素第一个子元素的所有p元素设置为粗体。
错误:是认为选择器会选择p元素的第一个子元素。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
p:first-child{
color:red;
}
</style>
</head>
<body>
<div>
<p>最好的我们</p>
<div>
<p>我不想在最剧了</p>
</div>
<p>我要好好看书了</p>
<p>我想<em>我想</em></p>
</div>
</body>
</html>
结合伪类:
a:link:hover{color:red;}
不要把互斥的伪类结合在一起使用,例如: a:link:visited
1701

被折叠的 条评论
为什么被折叠?



