html - nth-child, change style of every other div with class name -


i have got elements on page, should styled same except every other one, want change styling.

here css hoping select div inside stack of different elements:

.stagger_reviews[class=inner]:nth-child(2n+2) {     background-color:#003; } 

here html:

<div class="stagger_reviews"> <!-- later use php load reviews, css should switch images left right -->     <article class="container box style1">         <a style="background-image:url(images/blank-user.jpg); " href="#" class="image fit"></a>         <div class="inner">             <header>                 <h2>martyn ball</h2>             </header>             <p>                 found service on google search, didn't expect great!             </p>         </div>     </article>     <article class="container box style1">         <a style="background-image:url(images/blank-user.jpg); " href="#" class="image fit"></a>         <div class="inner">             <header>                 <h2>martyn ball</h2>             </header>             <p>                 found service on google search, didn't expect great!             </p>         </div>     </article> </div> 

as can see want adjust 1 div inside each article has class name inner. , maybe other elements once have working can that.

the style isn't being applied second inner div, have made 4 copies of article , none being changed.

here solution, put nth-child in wrong place.

.stagger_reviews > article:nth-child(2n+2) div[class=inner] 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -