Mick
Mick

Reputation: 2898

display two colours inside one td tag

Hi I want to display 2 different text colours in one area of table data IE:

         <tr>
         <td bgcolor="#FFFF00">This text is Yellow! and This test is blue </td>
         </tr>

Can I specify two colours inside one TD tag ? I thought this would be an easy task but I'm really struggling, Any help much appreciated !

Thanks

Upvotes: 1

Views: 6818

Answers (3)

ypcs
ypcs

Reputation: 91

You should use span -tags and learn CSS :)

<tr>
<td style="background: #ffff00;">

  <span style="color: yellow;">This text is Yellow!</span> and <span style="color: blue;">This test is blue</span>

</td>
</tr>

Upvotes: 1

Brandon
Brandon

Reputation: 70062

Wrap them in a container element, and apply the style to the wrapping element.

<td bgcolor="#FFFF00">
  <span style="color:yellow">
    This text is Yellow!
  <span style="color:blue"> 
    and This test is blue 
  </span>
</td>

Upvotes: 7

jcomeau_ictx
jcomeau_ictx

Reputation: 38492

use span tags with the appropriate bgcolor or style attributes:

<tr>
<td><span style="background: yellow">yellow</span> <span style="background: blue">blue</span></td>
</tr>

Upvotes: 1

Related Questions