How to change the color of just one word in a paragraph?

1

For example, in a paragraph:

<p id="paragrafo">
    Bla bla bla
    banana uva morango
    bla bla bla
</p>

How would I change the color of the word "grape", for example?

    
asked by anonymous 04.01.2019 / 02:40

3 answers

3
  

How to change the color of just one word in a paragraph?

Put a span , which is the tag most recommended for this purpose in the word uva and style it any way you want:

<p id="paragrafo">
    Bla bla bla
    banana <span style="color: #f00;">uva</span> morango
    bla bla bla
</p>

Another way, more ideal, would be to add a class to the tag span and stylize within a block with tag style :

<style type="text/css">
    .corVermelha {
        color: #f00;
    }
</style>

<p id="paragrafo">
    Bla bla bla
    banana <span class="corVermelha">uva</span> morango
    bla bla bla
</p>

PS: It is recommended that the tag style block be inside the tag block with% of HTML . However much it works out, it is advisable that you do so.

References:

  

HTML head Tag ;

     

HTML <span> Tag ;

Finally, I recommend that you study a little about the tags of HTML and about styling with CSS .     

04.01.2019 / 02:53
2

Hello, how are you?

Place your customizable text inside a tag and assign it a class, so you have a customizable inline element. I hope I have helped

.palavra{
  color: purple;
}
<p id="paragrafo">
Bla bla bla
banana 
morango
bla bla bla
<span class="palavra">uva<span> 
</p>
    
04.01.2019 / 02:47
1

You can do so

<p id="paragrafo">
    Bla bla bla
    banana <span style="color: #4286f4">uva</span> morango
    bla bla bla
</p>
    
04.01.2019 / 02:58