How to use HTML text color tags

Author: Monica Porter
Date Of Creation: 21 March 2021
Update Date: 27 June 2024
Anonim
How to Change Text Color in HTML
Video: How to Change Text Color in HTML

Content

This article will show you how to change font color on HTML documents. Although font tags are outdated in HTML, you can use CSS to add color to the text of an HTML page. If you are using an older version of HTML, you can use the HTML font tag as needed.

Steps

Method 1 of 2: Use HTML tags

  1. Create font tags. Set of cards in front of the text you want to change color. Place closing card behind the text.
    • Such as:
      This text will be blue.

  2. Add color attributes. Insert color = "" into the font open tab. The color you want will be in quotes.
    • For example:
      color = ""This text will be blue.

  3. Choose a color name. Color name is always one word with no spaces. Try something simple like "blue" (blue), "red" (red), or a descriptive name like "lightblue" or "darkblue" (dark blue). For more options, look up your list of recognized color keywords, which includes "maroon" (dark brown), "steelblue" (gray green) and "lime" (light yellow).
    • Such as:
      This text will be blue.

  4. Use hex color codes. HTML lets you choose from millions of colors, but not all colors have a name. Instead, they use a six-character code written in hexadecimal. On the web there are many websites that list hex color codes or let you pick a color on the screen and display the hex value. This code begins with a # sign and has six characters, including the numbers 0-9 or a letter A-F.
    • Code # FF0000 represents the color red.
    • This code produces green text.
    • This code produces blue text.
  5. Experiment with RGB values. You don't have to know how hex color coding works to be able to use an online color picker. However, if you want the experience, you can start with the basics:
    • Each six-character code is divided into the values ​​red, green (green) and blue ("RGB"). For example, the code # FF0000 means "red: FF green: 00 blue: 00."
    • To change the amount of red, change the first two characters. You can use any value from 00 (without red) to 99 (slightly red) or the letters AA (reddish) up to FF (maximum amount of red).
    • Use the same system to change the value to green (the two middle characters) or blue (the last two digits).
  6. Get a deeper understanding of hex color codes. To choose the correct color, you need to know the following two concepts:
    • Every three color values ​​are two digits. If you want to make less adjustments, just change the second digit. For example, # 850000 and # 890000 are quite similar, and # A50000 will be a bit brighter.
    • Combined RGB values ​​are equal to the color system plus. Red and green will produce yellow; blue and green form cyan; Red and blue will produce a burgundy color.
    advertisement

Method 2 of 2: Use an inline CSS element

  1. Insert the style attribute in the HTML tag. Properties style = "" allows you to use CSS in HML documents. Here's an easy way to set the font color even if you don't know about CSS. Try setting the style attribute to one of the HTML tags:
  2. Color designation. Insert color: with the color name or hexadecimal code inside the quotes. For more details about the names and color codes, see the method above or try the following examples:
    • This code constitutes red text.
    • This code produces a dark olive green color.
    • CSS supports 3-digit shortening. Color code 745 stands for 774455.
  3. Use CSS classes with typefaces that you use often. If you want to style every image caption or title for a piece of content on a large web page, you don't need to type the entire code over and over again. Instead, define a CSS class at the beginning of the text, so you can call the class with just one shorthand every time you want to use that style. Here is an example showing some new uses of the style attribute:
    • In section of the HTML document, paste the following code:
    • Next, in the body of the text, use the attribute to add this style as an element. Such as,

      this paragraph

      dark green, large Cursive font.
    • Note that you can use any word instead of "fancy" to describe a typeface.
    advertisement

Advice

  • You should try to make your page easy to read. Light text colors will be hard to read on white, and dark text colors will be hard to read on black.
  • Older computers display a limit of 65,000 colors, while older computers display a limit of 256 colors. However, over 99% of internet users will be able to see the color you specify.

Warning

  • The font element is not supported on the XHTML 1.0 Strict DTD standard.