当前第2页 返回上一页

(4)属性选择器:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!DOCTYPE html>
<html lang= "en" >
<head>
<meta charset= "UTF-8" >
<meta http-equiv= "X-UA-Compatible" content= "IE=edge" >
<meta name= "viewport" content= "width=device-width, initial-scale=1.0" >
<title>Document</title>
<style>
div[id=class2]{
background-color: brown;
}
</style>
</head>
<body>
<div id= "class1" >div</div>
<div id= "class2" >div</div>
<div id= "class3" >div</div>
</body>
</html>
|
效果如下:
![1621502781156080.png 520GAV8_@1EFQ0J]3D`3UL7.png](http://ypimg.muzhuangnet.com/Collect/csharp/upload/image/962/368/703/1621502781156080.png)
(5)伪类选择器:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "UTF-8" >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< title >Document</ title >
< style >
a:link{
color: brown;
background: cornsilk;
}
a:hover{
text-decoration: none;
color: rgb(252, 0, 0);
}
a:active{
background: rgb(202, 0, 175);
color: rgb(59, 59, 59);
}
a:visited{
color: brown;
background: cornsilk;
}
</ style >
</ head >
< body >
< a href = "#" >哈喽,看我,你在干什么</ a >
</ body >
</ html >
|
效果:

推荐学习:css视频教程
以上就是css选择器的分类有哪些的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
css阴影效果如何实现
css边框显示不出来怎么办
css animation-direction属性怎么用
css盒子模型是什么意思?
css如何将图片并排
css如何关闭浮动
css怎么实现不透明度渐变
css中的块级元素是什么
表示行高的css属性是什么
css中实现背景透明的三种方式
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css选择器的分类有哪些