-1

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>
asmgx
  • 7,328
  • 15
  • 82
  • 143
  • 2
    maybe read more about CSS .... the info tag should give you the answer: https://stackoverflow.com/tags/css/info – Temani Afif Jun 14 '20 at 11:57

1 Answers1

0

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

.color{
    color:red;
     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!

Jon dreisbach
  • 206
  • 1
  • 3
  • 14