hi all, how do you have a piece of text to be a different colour within an overall colour font tag- is that possible? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

hi all, how do you have a piece of text to be a different colour within an overall colour font tag- is that possible?

See the code below, i can't get the sevomd piece of text to be a different colour at all, whether the font tag is in header or attached indiviually to each tag, Any help appreciated, thanks! <!DOCTYPE html> <html> <head> <title>Lego using HTML5</title> </head> <body bgcolor="#d2b48c"> <header bgcolor="40E0D0"> <font color="40E0D0"> <h1 align="center" color="40E0D0" > <b>lego</b> </h1> </h2 align="right"> <i>More </i>Lego <font color="#FF69B4"> </font> </h2> </font> </header> </body> </html>

25th Jul 2017, 10:56 PM
Andy
2 Answers
+ 12
In addition to Usopp's answer, color is an attribute of the deprecated <font> element, it does not work with other elements such as: <h1> and/or <h2> If you want to change the color, you should replace the "color" attribute in the <h1> with CSS rules, something like: <h1 style="color:#40e0d0"></h1> ... same for the bgcolor attribute inside the <header> element, it does not work too, guess why? Exactly, the <header> semantic element is introduced by HTML5 and the bgcolor attribute has been deprecated by mrW3. :)
25th Jul 2017, 11:47 PM
Maz
Maz - avatar
+ 2
# symbol is missing for the first time you used font tag color attribute Also your h2 tags are both closing, there's no opening one Anyways font tags are deprecated Place color attribute in your body tag, h1, h2, or header tags instead. Actually that's also going to change once you learn CSS.
25th Jul 2017, 11:40 PM
God Usopp
God Usopp - avatar