伪类:条件
/*ul的第一个子元素*/
li:first-child {
background: red;
}
/*ul的最后一个子元素
*/
li:last-child {
background: red;
}
/*定位到父元素,选择当前的第一个元素*/
p:nth-child(1) {
background: red;
}
/*定位到父元素,选择当前的第一个p元素*/
p:nth-of-type(1) {
background: red;
}