Quackit Logo

Got a MySpace Page?

Get "www.yourname.com" for your MySpace page. Learn how >>.

HTML Text Color Code

Print Version

You can use the following HTML code to specify colors for text within your HTML documents.

To define text color in HTML you should use CSS (Cascading Style Sheets).

Setting Text Color using Inline Styles:

<p>Normal text color <span style="color:green">different text color</span> normal text color</p>

This code results in:

Normal text color different text color normal text color

Setting Text Color using Embedded Styles:

<html>
<head>
<style type="text/css">
p.different-text-color { color: green; }
</style>
</head>
<body>
<p>Normal text color
<span class="different-text-color">different text color</span>
normal text color</p>
</body>
</html>

This code results in:

Normal text color different text color normal text color

The CSS code is inserted between the <style> tags within the head of the document. It could also have been defined in an external style sheet.

You can also check out the hex color codes page to learn about colors in HTML and CSS.

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
                     
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!