Set Text Color Using color [6/16]

The text color is specified using the color property. You can set the color value in different ways:

  • As a hexadecimal code, e.g., #FF9900.
  • Using a keyword, e.g., red.
  • In the RGB format: rgb(255, 255, 0).

Most commonly, the color is specified in the hexadecimal format.

Do it
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Set Text Color Using color:</title> </head> <body> <h1>JavaScript Stage</h1> <p>In the fourth stage, the <i>interaction</i> with the interface is refined: this may include various AJAX based solutions, dynamic elements, calendars, etc. This suggests full-fledged use of JavaScript. This stage empowers the ease of use of the interface.</p> <p>Let&apos;s now summarize the purpose of the above steps:</p> <ol> <li>Document&apos;s meaning and purpose, its logical layout. Technology: HTML.</li> <li>Appearance. Technology: CSS.</li> <li>Impeccable appearance. Technology: CSS3.</li> <li>Interactivity, ease of use and comfort. Technology: JavaScript.</li> </ol> </body> </html>
h1 { font-size: 24px; }
HTML Academy

Let's practice with different text color values now.

  1. For <h1>, set the text color of #B94A48
  2. Make the <i> text green
  3. For <li>, set text color to rgb(58, 135, 173).
Theory Check Next