본문 바로가기

기존카테고리/CSS

CSS :nth-of-type() Selector

CSS :nth-of-type() Selector

<!DOCTYPE html>

<html>

<head>

<style> 

p:nth-of-type(3n+0) {

    background: red;

}

</style>

</head>

<body>


<p>The first paragraph.</p>

<p>The second paragraph.</p>

<p>The third paragraph.</p>

<p>The fourth paragraph.</p>

<p>The fifth paragraph.</p>

<p>The sixth paragraph.</p>

<p>The seventh paragraph.</p>

<p>The eight paragraph.</p>

<p>The ninth paragraph.</p>


</body>

</html>


https://www.w3schools.com/cssref/sel_nth-of-type.asp