html - Applying CSS to Drupal -


i working drupal 8 , ubercart. trying change color of "add cart" button red green. below code on each products page.

<input name="op" class="button js-form-submit form-submit" id="edit-submit-    32" type="submit" value="buy now" data-drupal-selector="edit-submit-32"> 

so did in css file following...

#edit-submit-32 {     color: #fff;     background-color: #0f3;     font-weight:bold; } 

this worked 1 particular product wondering if there css use make change current products , future products? code each products same difference id tag each product. appreciated.

the first thing identify if of these kinds of buttons have similar parent container , use parent selector:

<div class="add-to-cart-wrapper">   <input name="op" class="button js-form-submit form-submit" id="edit-submit-    32" type="submit" value="buy now" data-drupal-selector="edit-submit-32"> </div>  .add-to-cart-wrapper .button {     color: #fff;   background-color: #0f3;   font-weight:bold; } 

without more html context, can't provide actual parent selector - but sake of example have added div class "add-to-cart-wrapper". replace selector applicable one.

it's rule of thumb try , use classes rather ids css.


Comments