How do you put 2 different properties in 2 parts with the same selector?


How do I change this code?

I am trying to make separate background colors, and in CSS they both use span for the selector, but I tried a few combos and it didn't work. Does anyone know how to put 2 separate properties in two parts that both use span?

span {
    background-color:#ffff66; red;


I prefer using spans for in-line styling (like adding highlight to a word in a paragraph) and I think that was the intended use.
If you are planning to do styling using CSS, I suggest divs.

If you plan on using span, just do this:

<span style="background-color: red;"></span>
<span style="background-color: #ffff66;"></span>

If you want to have two of the same selectors but different values for their properties, I suggest being more specific with targeting those two. Such as using :nth-child or if they both have different parents, something like div > li.