Home > Article > Web Front-end > A pitfall of css3 nth-child(n)_html/css_WEB-ITnose
CSS matching selects the nth child element. You can use the :nth-child(n) selector, which matches the Nth child element belonging to its parent element, regardless of the type of the element.
<div class="content-wrap"> <h1>hahaah</h1> <h1>hahaah</h1> <p>xixi1</p> <p>xixi2</p> <p>xixi3</p> <p>xixi4</p> </div>
The one that turns red is xixi1