How to set different colors in HTML in one statement?

Viewed 149607

I'm thinking of having different color of text in one line. How could that be possible?

<p style="color:#4C4C4C;font-weight:bold;font-family:Calibri;font-size:20"> My Name is: 

 <"color:#FF0000;font-weight:bold;font-family:Tahoma;font-size:20"> Tintincute </p>

I would like to have a different color for Tintincute but in one line the problem with this, the name went down one space.

This is the code example:

<p style="color:#4C4C4C;font-weight:bold">All fields marked with   <style="color:#FF0000;font-weight:bold">*</color> <style="color:#4C4C4C;font-weight:bold">are required</p>

Update

@Phil: I tried using the code, but it didn't work. The code itself was shown on the page. This is how I did it:

<div style="color:red">[+validationmessage+]</div>
p.detail {color:#4C4C4C;font-weight:bold;font-family:Calibri;font-size:20 }
span.name {color:#FF0000;font-weight:bold;font-family:Tahoma;font-size:20 }
<p class="detail">My Name is: <span class="name">Tintincute</span> </p>
6 Answers

I know it's kinda clunky but it does the work

if you have, for example:

<a>Color1 Color2</a>

You can just style part of the text inside

<a>Color1 <a style=color:yellow>Color2</a></a>

output

enter image description here

<p style="font-weight:bold"> ¿ is this color   
                <span style="color:red; font-weight:bold"> red? </span> 
                <span style="font-weight:bold"> ? </span>   
            </p>

Related