HTML: change text color - how it works
This guide shows you how to change the text color using an HTML tag. Note that HTML tags overwrite any CSS presets from external files.
Change text color with HTML
With the tag you can change the color of a text in HTML:
- Enclose the text you want to color in the tag.
- Extend the tag with the attribute "color" and enter a color - for example "red", "yellow" or "blue". Alternatively, you can enter a color value using the hexadecimal code after "color".
- Your finished HTML tag looks like this: Text.
For large HTML documents, you should define the layout using CSS. We show you how to embed CSS in HTML documents.