Solution 1 :

you can put them both into the same class i.e.

     background-color: blue;

or you can call 2 classes to the same tag like this as long as the css does not conflict with each other

<span class="fontColor backColor"></span>

hope this helps!

Problem :

Is there a way I can set 2 classes for the same span?

certain text in my HTML should have 2 classes

for the sake of simplicity I will make it just background-colour and font color

class FontRed that has color:Red;
class FontYellow that has color:Yellow;
class FontGreen that has color:Green;
class FontBlue that has color:Blue;

class BackRed that has background-color:Red;
class BackYellow that has background-color:Yellow;
class BackGreen that has background-color:Green;
class BackBlue that has background-color:Blue;

is there a way I can choose 2 class for the same

something like this

<span class="FontBlue;BackYellow;">Blue and Yellow back</span>
<span class="FontRed;BackGreen;">Red and Green back</span>


Comment posted by

maybe read more about CSS …. the info tag should give you the answer: