Two colors in the same word in html

1

I need to put two colors in the same word in html, the word is inside a h1 tag, everything I try makes a half word go to a second line for example

<h1>promociones</h1>
    
asked by Basicmix 10.03.2018 в 23:50
source

2 answers

3

If you have short courses or id to insert more colors in one word:

<h1><span style="color:green">MAR</span><span style="color:yellow">IHU</span><span style="color:red">ANA<span></h1>

Simply every part of your word or phrase that you want to change the color in, close it with a span and you put the color you want, but if there are only a few colors that you want to change in a word, use a class or an id like the example from above to keep aesthetics in the code.

    
answered by 11.03.2018 / 00:30
source
3

You can divide it with span elements, assigning different colors, for example:

h1 { color: blue }
span { color: red }
<h1><span>promo</span>ciones</h1>
    
answered by 10.03.2018 в 23:54