css - how do I select .class-a:nth-child only when it also has class .class-b -
i have grid of images. within grid have albums. albums displayed single image (images-album-cover) until expanded, after entire album displayed among rest of images (images-album-images).
both images-album-cover , images-album-image have class images-image-col. images-image-col class of rest of non-album images.
i've added border (with div, not actual border) bottom of each album image indicate images part of album.
i need able few things:
select each images-album-cover or images-album-image on left side of grid.
select each images-album-cover or images-album-image on right side of grid.
select each images-album-image last image in album.
so far have been able select left images , right images when grid has non-album images, i'm @ loss of how handle albums when need it. not unable select nth-child when matches class, when grid has albums in @ nth-child stops working no albums though i'm trying target images (images-image-col)
heres fiddle of working (on large screens) without albums.
as started albums, haven't been able select first images-album-cover, tried this:
&:nth-child(2n+1) { .images-album-cover { outline: 1px dashed mediumvioletred; } }
and doesn't seem anything
here html album
<div class="col-xs-6 col-sm-4 images-image-col images-album-cover open"> <a class="thumbnail image images-image-thumbnail"> <img> <div class="album-label"> <figcaption>asdfasf <span>(5)</span></figcaption> </div> </a> <div class="images-album-cover-bar"></div> </div> <span id="gallery-detail-22"> <div class="col-xs-6 col-sm-4 images-image-col images-album-image"> <a class="thumbnail image images-image-thumbnail"> <img> </a> <div class="images-album-image-bar"></div> </div> <div class="col-xs-6 col-sm-4 images-image-col images-album-image"> <a class="thumbnail image images-image-thumbnail"> <img> </a> <div class="images-album-image-bar"></div> </div> <div class="col-xs-6 col-sm-4 images-image-col images-album-image"> <a class="thumbnail image images-image-thumbnail"> <img> </a> <div class="images-album-image-bar"></div> </div> <div class="col-xs-6 col-sm-4 images-image-col images-album-image"> <a class="thumbnail image images-image-thumbnail"> <img> </a> <div class="images-album-image-bar"></div> </div> <div class="col-xs-6 col-sm-4 images-image-col images-album-image"> <a class="thumbnail image images-image-thumbnail"> <img> </a> <div class="images-album-image-bar"></div> </div> </span>
i'm open js solution if guys think better in case i'd still know if possible.
try this:
:nth-child(2n+1).images-album-cover { outline: 1px dashed mediumvioletred; }
Comments
Post a Comment