How does one select the class jdgm-paginate__page
unless jdgm-paginate__next-page
is also applied to the element?
<a class="jdgm-paginate__page " data-page="2">2</a>
<a class="jdgm-paginate__page jdgm-paginate__next-page" data-page="2"></a>
How does one select the class jdgm-paginate__page
unless jdgm-paginate__next-page
is also applied to the element?
<a class="jdgm-paginate__page " data-page="2">2</a>
<a class="jdgm-paginate__page jdgm-paginate__next-page" data-page="2"></a>
Use the :not()
pseudo-class:
.jdgm-paginate__page:not(.jdgm-paginate__next-page):not(.jdgm-paginate__last-page) {
color: red;
}
a {
display: block;
}
<a class="jdgm-paginate__page " data-page="2">select</a>
<a class="jdgm-paginate__page jdgm-paginate__next-page" data-page="2">don't select next</a>
<a class="jdgm-paginate__page jdgm-paginate__last-page" data-page="2">don't select last</a>
You can use the CSS :not pseudo class. For example:
.jdgm-paginate__page {
background: red;
}
This would make all elements with that class red regardless of additional classes.
.jdgm-paginate__page:not(.jdgm-paginate__next-page) {
background: red;
}
All elements with class .jdgm-paginate__page but no with .jdgm-paginate__next-page will be red
Maybe not the best solution, but you can also use attribute selector to select your specific element in case you don't know what are the other classes:
[class="jdgm-paginate__page"] {
color: red;
}
a {
display: block;
}
<a class="jdgm-paginate__page" data-page="2">select</a>
<a class="jdgm-paginate__page jdgm-paginate__next-page" data-page="2">don't select next</a>
<a class="jdgm-paginate__page jdgm-paginate__last-page" data-page="2">don't select last</a>