Home  >  Article  >  Web Front-end  >  A pitfall of css3 nth-child(n)_html/css_WEB-ITnose

A pitfall of css3 nth-child(n)_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:42:411089browse

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>

.content-wrap p:nth-child(3) {
color:red;
}

The one that turns red is xixi1

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn