0

I got a piece of code as seen in the image below in a Smarty template outputting the payment method. Please help me a find a way to set color "red" only to the value of "{$search_results_list[searchresults].cc_type}". Thank you.

enter image description here

0

What does the surrounding HTML look like?

If you cannot edit the HTML to add classes you could use :nth selector to select that second span tag, ie.

.surrounding-div span:nth-child(2) {color: red;}

Or if there are multiple span elements you could get more specific like this:

.surrounding-div span[title^="Payment"]:nth-of-type(2) {color: red;}

If you provide more of the template HTML it would be easier to answer more accurately.

| improve this answer | |
  • Thanks Readio. Your solution looks more elegant and useful when having multiple span elements. – CodeForGood May 4 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.