CSS中获取ul第一个li有以下三种方法:
// 方法一:使用:first-child伪类选择器 ul li:first-child { /* 样式 */ } // 方法二:使用:first-of-type伪类选择器 ul li:first-of-type { /* 样式 */ } // 方法三:使用nth-child伪类选择器 ul li:nth-child(1) { /* 样式 */ }
扫一扫分享
62845
帖子
12
小组
80
积分
发帖
回复
分享