# 자식 요소 필터 선택자

### 자식 요소 필터 선택자

![](https://2619844618-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MJPDnIWvkFeSYsFAt99%2F-MJUV_AJN4mBZ_fZ1L4F%2F-MJUVcnu9cVlpo1wrefm%2Fimage.png?alt=media\&token=64c015ec-03fa-4b3c-a276-8ac0e870a165)

```javascript
//자식 요소 필터 선택자
$("li:first").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:first-child").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:last").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:last-child").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:nth-child(4)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:nth-child(2n+1)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:nth-child(odd)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:nth-child(even)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
$("li:only-child").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f"});
```
