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.
1 Answer
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.
-
Thanks Readio. Your solution looks more elegant and useful when having multiple span elements. May 4, 2020 at 0:01