如何更改一个特定的CSS类

问题描述 投票:0回答:1

我有一个问题,我通过Wordpress开发了一个网站,并希望以一种方式设置所有产品价格,以及小计,税收和总计另一种方式。他们都在CSS类中作为woocommerce-Price-amount金额。无论如何我只能瞄准tr“cart_item”里面的那些?谢谢!

 <table class="shop_table woocommerce-checkout-review-order-table" style="border-color: rgb(255, 255, 255);">
<thead style="background-color: rgb(0, 0, 0);">
    <tr>
        <th class="product-name" style="border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Product</th>
        <th class="product-total" style="border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Total</th>
    </tr>
</thead>
<tbody>
                        <tr class="cart_item">
                    <td class="product-name" style="border-color: rgb(255, 255, 255);">
                        Autumn Leaf Shirt - Large&nbsp;                          <strong class="product-quantity">× 2</strong>                                                  </td>
                    <td class="product-total" style="border-color: rgb(255, 255, 255);">
                        <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>70.00</span>                       </td>
                </tr>
                    </tbody>
<tfoot>

    <tr class="cart-subtotal">
        <th style="background-color: rgb(0, 0, 0); border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Subtotal</th>
        <td style="border-color: rgb(255, 255, 255);"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>70.00</span></td>
    </tr>




                                <tr class="tax-total">
                <th style="background-color: rgb(0, 0, 0); border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Tax</th>
                <td style="border-color: rgb(255, 255, 255);"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>0.00</span></td>
            </tr>


    <tr class="order-total">
        <th style="background-color: rgb(0, 0, 0); border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Total</th>
        <td style="border-color: rgb(255, 255, 255);"><strong><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>70.00</span></strong> </td>
    </tr>


</tfoot>

javascript css wordpress
1个回答
1
投票

是!您可以专门针对woocommerce-price-item内部的cart_item

.cart_item .woocommerce-Price-amount{ /**Your Properties here**/ }

这只会将您的属性应用于具有类woocommerce-Price-amount的元素中具有类cart_item的元素

基本上在CSS中,您可以访问bar中的foo

.foo .bar{ }

© www.soinside.com 2019 - 2024. All rights reserved.