This article shows you how to change the coloring of text within a web page using HTML code. While the "font" tag is no longer used within HTML5 code, you can use CSS style sheets to manage the coloring of your HTML page text. If you are using an older version of the HTML code, you can still use the "font" tag according to your needs.
Steps
Method 1 of 3: Using CSS Style Sheets
Step 1. Choose the color in which to display the text
Depending on your needs, you can choose to use standard colors (for example "red" if you want the text to appear in red) for the text of your page, but if you need to use a particular shade you will have to create it using a generator. of colors:
- Access this web page https://www.w3schools.com/colors/colors_picker.asp using your computer browser.
- Choose the base color you want to start from among those listed in the hexagon at the top left of the page.
- At this point, select the hue from those shown on the right side of the page.
- Now take note of the six-digit hexadecimal code located to the right of the color tone you have selected.
Step 2. View the HTML code of your document
This is the source code of the web page you want to change the color of the text.
If you haven't created this HTML document yet, do so now before continuing
Step 3. Find the portion of text you want to change the color of
Scroll through the source code of the page in question until you find the paragraph, heading, title, or piece of text you want to apply the new coloring to.
Step 4. Look at the text identifier tag
For example, if the content to be edited is a title or a header, it will be characterized by the tag"
".
Step 5. Add the "head" and "style" sections to the beginning of the HTML document
Insert the code after the "" tag, press the Enter key, type the code below the "" tag, press the Enter key twice again and add the respective closing HTML tags. After completing the changes indicated, the structure of your HTML document should be as follows:
Step 6. Insert the "color" tag in the correct position
Place the cursor of the text inside the section delimited by the "" tags, then enter the following code (in the example the red color indicated by the red tag is used, so you will have to replace it with the name or code of the color you want to use. The style created will be applied to the text defined by the"
", but also in this case you can replace it with the one that identifies the portion of content to which you want to apply the new color):
{color: red; }
Step 7. Examine your HTML document
The source code of the web page you created should look like this:
Step 8. Change the text color of the "body" section
If you need all the text on the page to have the same color, use the following code using the keyword black to indicate the color to use (in this case black):
body {color: black; }
Method 2 of 3: Using HTML Tags
Step 1. Choose the color in which to display the text
Depending on your needs, you can choose to use standard colors (for example "red" if you want the text to appear in red) for the text of your page, but if you need to use a particular shade you will have to create it using a generator. of colors:
- Access this web page https://www.w3schools.com/colors/colors_picker.asp using your computer browser.
- Choose the base color you want to start from among those listed in the hexagon at the top left of the page.
- At this point, select the hue from those shown on the right side of the page.
- Now take note of the six-digit hexadecimal code located to the right of the color tone you have selected.
Step 2. View the HTML code of your document
This is the source code of the web page you want to change the color of the text.
If you haven't created this HTML document yet, do so now before continuing
Step 3. Find the portion of text you want to change the color of
Scroll through the source code of the page in question until you find the paragraph, heading, title or piece of text to which you want to apply the new coloring of your choice.
Step 4. Add the HTML "font" tag
Place the mouse cursor on the left of the text you want to change the coloring and press the left button, then insert the following HTML code (remember to replace the keyword red, relative to the color red, with the one that defines the color of base you want to use):
Step 5. Type the text you want to display with the chosen coloring and add the closing tag "/ font"
After inserting the textual content that will have to take on the desired color, add the closing tag. When you are done editing, the HTML code should look like this:
This text will appear in red!
Method 3 of 3: HTML Code Examples
Advice
- The HTML codes used to customize the colors work as follows: the first two characters refer to the red tone, the two central characters refer to the green tones, while the two characters on the right refer to the blue. It is a hexadecimal number, so for each digit you can use values ranging from "0" to "F", where the first represents the minimum and the second the maximum. For example the code "0000FF" indicates the deepest shade of blue that can be used.
- Try to create a web page that is easy to read. Remember that very intense and bright colors are difficult to read when paired with a white background and that dark colors have the same problem when paired with a black background.
- Older computers use a limited color gamut of 65,000 colors, while for very old systems this limit is only 256 colors. However, almost all internet users will be able to correctly display any color you choose to use.