HTML文件
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>
<body>
<a href="css练习一.html">去css练习一</a>
<a href="https://www.baidu.com/">百度一下</a>
<a href="csstest.html">我是a标签</a>
<p class="p1">我是p标签</p>
<div class="box"> sf</div>
<p>我是p标签</p>
<p>我是p标签</p>
<p>我是p标签</p>
</body>
</html>
css外联文件
a:link{
color: red;
}
a:hover{
color: yellow;
}
a:active{
color: green;text-decoration: underline;
}
a:visited{
color: gray;
}
.p1:hover{
color: red;
}
.box{
height: 100px;
width: 100px;
background: pink;
}
.box:hover{
background: blue;
}
a:before{
content: "@";
}
p:after{
content:url(../img/jd.jpg);
}
p:before{
/*content: url(../img/jd.jpg);*/
content: "$";color: green;
}
p:hover{
color: red;text-decoration: underline;
}
运行效果如下: