博主信息
博文 3
粉丝 0
评论 0
访问量 1618
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
作业标题:1020作业
手机用户079579413
原创
480人浏览过

演示权重的原理与计算方式

代码

h1{
color: aqua;
}
h1.title{
color: black;
}
h1#active.title{
color: antiquewhite;
}

分别为(0,0,1)(0,1,1)(1,1,1)

结构伪类,通过位置关系匹配子元素

代码

<!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> 实例演示结构伪类</title>
<link rel="stylesheet" href="css/fake-class.css">
</head>

<body>
<ul class="list">
<li class="li">item1</li>
<li class="li">item2</li>
<li class="li">item3</li>
<li class="li">item4</li>
<li class="li">item5</li>
<li class="li">item6</li>
<li class="li">item7</li>
<li class="li">item8</li>
</ul>

</body>
</html>

css代码

.list>li:nth-of-type(1){
background-color: aqua;
}
/ 匹配第二个 /
.list>li:nth-of-type(2){
background-color: rgb(25, 147, 76);
}
/ 匹配第三个 /
.list>li:nth-of-type(3){
background-color: rgb(25, 147, 76);
}
/ 匹配第四个 /
.list>li:nth-of-type(4){
background-color: rgb(25, 147, 76);
}
/ 匹配第五个 /
.list>li:nth-of-type(5){
background-color: rgb(25, 147, 76);
}
/ 匹配第六个 /
.list>li:nth-of-type(6){
background-color: rgb(25, 147, 76);
}
/ 匹配第七个 /
.list>li:nth-of-type(7){
background-color: rgb(73, 54, 63);
}

/ 匹配第八个 /
.list>li:nth-of-type(8){
background-color: rgb(106, 22, 161);
}

批改老师:PHPzPHPz

批改状态:合格

老师批语:代码内容可以写在代码块中,这样会有高亮显示,方便阅读
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学