I am trying to create HTML text that contains two colors (yellow and white), without creating a new line when switching colors. I have attempted to do this:
<p style="color:fc0;background-color:404040">Text Color Yellow <style="color:fff">Text Color White</p>
It doesn't work, as there is no p
coming before the style
element to change the color.
My other way is to make two lines, but there is a bar of blank whitespace between the two lines of gray:
<p style="color:fc0;background-color:404040">Text Color Yellow</p>
<p style="color:fff;background-color:404040">Text Color White</p>
Wrap the white text in span
. And, then set it's color property to white. This will work:
<p style="color:#fc0000;background-color:#404040">Text Color Yellow <span style="color:#ffffff">Text Color White</span></p>
Note: You are also missing #
signs in color codes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With