批改状态:合格
老师批语:
<head><link rel="stylesheet" type="text/css" href="mystyle.css"></head>
<head><style>hr {color:sienna;}p {margin-left:20px;}body {background-color:pink;}</style></head>
<p style="color:pink;font-size:20>value</p>-语法格式:@import url(value)
li{background-color:red;}
可简化为
li[class="name"]{background-color:pink;}
.name{backgorund-color:pink}
可简化为:
li[id="name"]{background-color:pink;}
#name{background-color:pink;}
ul li{color:pink;}
body>ul>li{margin-top:5px;}
.name + li {color:pink;}
.name ~ li {background-color:white;}
:nth-of-type(an+b)(an为起点,b为偏移量,n从0开始取值)常规写法:
ul li:nth-of-type(0n+5){color:red;}
简化写法:
ul li:nth-of-type(5){color:red;}
选择所有元素的写法(使用伪类选择器,如果带上偏移量,效果大有不同)
ul li:nth-of-type(1n){color:red;}
带有偏移量的用法
ul li:nth-of-type(1n+3){color:red;}
带有偏移量的简化写法
ul li:nth-of-type(n+3){color:red;}
9.结构伪类-反向匹配任意伪类的元素,使用方法
语法结构:nth-last-of-type(an+b)(an为起点,b为偏移量,n从0开始取值)
ul li:nth-last-of-type(-n+3){color:red;}
10.结构伪类,选择所有索引为偶|奇数的子元素
偶数行:even;奇数行,odd
ul li:nth-of-type(even){color:red;}
ul li:nth-of-type(odd){color:red;}
11.结构伪类,选择第一个元素 :frist-of-type
选择最后一个 :last-of-type
$.ajax() 后期学习
12.如果只想匹配父元素里唯一子元素,使用 only-of-type实现
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号