In a WooCommerce shop sometimes I do have 3 <p>
and sometimes I do have 2 <p>
(depends on the product)
How to I archive to add a padding to the last <p>
but only if there are 2 <p>
are shown. No padding should be added when all 3 <p>
are shown.
<div class="astra-shop-thumbnail-wrap">
<a href="#" class="woocommerce-LoopProduct-link woocommerce-loop-product__link"><img width="186" height="186" src="#"> </a>
<div class="label-group">
<a href="#" class="woocommerce-LoopProduct-link woocommerce-loop-product__link"></a>
<div class="categories-link">
<a href="#" class="woocommerce-LoopProduct-link woocommerce-loop-product__link"></a>
<a href="#" class="sfinkslinks">Accessoires</a>
<a href="#" class="sfinkslinks">Schale</a>
</div>
</div>
<p class="wc-gzd-additional-info tax-info">inkl. MwSt.</p>
<p class="wc-gzd-additional-info shipping-costs-info">zzgl. Versandkosten</p>
<p class="wc-gzd-additional-info delivery-time-info">Lieferzeit: 5 - 7 Werktage</p>
</div>
2
Answers
You can make use of
+
selectorA combined selector which includes both:
:last-of-type
:nth-of-type(2)
will select only those elements which are both second and last in the current series.
e.g.
Working Example: