HTML Text Size

HTML Text Size

HTML Text Color

HTML Text color is used to give colors (like red, green, blue etc.) to the text on web page.

  • HTML Text Color is defined by style="color:value;" syntax.

  • Value can given by color name (like green), by rgb code (like rgb(200,0,150)) or by Hex code (like #aaff33).

  • It can be used with any HTML element inside Opening tag.


Example:

<p style="color:red;">The text color becomes red.</p>

Example Explanation:

In the above, we have shown an example of HTML Text Color with color name.

  • There are thousands of name of the colors that we can use to give HTML Text Color.

      Red

      White

      Silver

      Gray

      Yellow

      Lime

      Green

      Aqua

      Blue

      Purple

Run the code to see the effect.

Example:

<p style="color:rgb(0,128,0);">The text color becomes green.</p>

Example Explanation:

In the above, we have shown an example of HTML Text Color with RGB(Red,Green,Blue) values.

  • There are thousands of rgb values of the colors that we can use to give HTML Text Color.

      rgb(255,0,0)

      rgb(255,255,255)

      rgb(192,192,192)

      rgb(128,128,128)

      rgb(255,255,0)

      rgb(0,255,0)

      rgb(0,128,0)

      rgb(0,255,255)

      rgb(0,0,255)

      rgb(128,0,128)

Run the code to see the effect.

Example:

<p style="color:#800080;">The text color becomes purple.</p>

Example Explanation:

In the above, we have shown an example of HTML Text Color with Hex values.

  • There are thousands of Hex values of the colors that we can use to give HTML Text Color.

      #FF0000

      #FFFFFF

      #C0C0C0

      #808080

      #FFFF00

      #00FF00

      #008000

      #00FFFF

      #0000FF

      #800080

Run the code to see the effect.