Skip to content
doubtly

2 answers

Use the CSS color property through the style attribute or a stylesheet; this is the correct method in HTML5.

<p style="color:red;">This is a demo</p>
<p style="color:#0000FF;">This is another demo</p>

<style>
  h1 { color: green; }
</style>

The colour may be a name (red), hex code (#FF0000), rgb(255,0,0) or hsl(). What is not supported in HTML5 is the old <font color="..."> tag; the style attribute shown above is fully valid.

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.