부모의 마지막 자식인 모든
요소의 스타일을 지정하려면 CSS :last-child 선택기를 사용하십시오. 다음 코드를 실행하여 :last-child 선택기를 구현할 수 있습니다.
예시
<!DOCTYPE html>
<html>
<head>
<style>
p:last-child {
background: orange;
}
</style>
</head>
<body>
<p>This is demo text1.</p>
<p>This is demo text2.</p>
<p>This is demo text3.</p>
</body>
</html> 출력
