HTMLs Tutorial

HTML Tutorial HTML Tags HTML Basic Tags HTML Attributes HTML Elements HTML Formatting HTML Text Format HTML body tag HTML samp tag HTML script Tag HTML section tag HTML select tag HTML source tag HTML span tag HTML strike tag HTML strong tag HTML style tag HTML sub tag HTML summary tag HTML sup Tag HTML svg tag HTML table tag HTML u tag HTML Headings HTML Paragraphs HTML wbr tag HTML Anchor HTML Image HTML Lists HTML Ordered List HTML Unordered List HTML Form HTML Form input HTML with CSS HTML Layouts HTML References HTML Frames HTML Links Fieldset Tag in HTML Basic HTML Tags Br Tag in HTML Free HTML Templates How to Create a Table in HTML HTML Calendar HTML Card HTML Cellspacing HTML Center Image HTML Checkbox Read-only HTML Cleaner HTML Code for a Tab HTML Comment HTML Compiler HTML Nested Forms HTML Overlay Text on the Image HTML Select Option Default HTML Snake Game HTML Subheader HTML Tab Character dd Tag in HTML How Many HTML Tags are There HTML Align Tag HTML Responsive HTML Tab Code HTML Table Alternate Row Color HTML Table Fix Column Width Contact HTML DL Tag in HTML How to Insert Image in HTML HTML Background Color HTML Dark Mode How to Convert HTML to PNG HTML Data Toggle HTML Email Template HTML Font Color HTML Font Family ID and Class in HTML HTML Tab Space HTML Tab Tag HTML Itemprop HTML Itemscope HTML Form Design HTML Input Only Numbers HTML Textarea HTML to JPG HTML to Markdown Python li Tag in HTML MDN HTML What is the Correct HTML for Making a Hyperlink? What is the Root Element of an HTML Document How to Make a Box in HTML How to Save HTML Files in Notepad How to Align Text in HTML How to Change Font Color in HTML? How to Change Font Size in HTML How to Change Image Size in HTML How to Create a HTML Page How to Create a Link in HTML File? How to Create an HTML File? HR Tag in HTML HTML Base Tag HTML Default Attribute HTML Hyperlink HTML Indent HTML Injection Payloads HTML Input Numbers Only HTML Roadmap HTML Row Height HTML Schedule HTML Space HTML Tab HTML vs HTTP HTML5 API HTML5 Video HTML Collection to Array Text Area in HTML

HTML5 Advance

HTML5 Tutorial HTML5 Tags HTML Button Tag HTML canvas Tag HTML caption Tag HTML City tag HTML Tag HTML5 SVG HTML Event Attribute HTML5 Audio HTML5 Youtube HTML5 Button Tag HTML5 Tags

Misc

How to add JavaScript to HTML How to change font in HTML How to change text color in HTML HTML Date HTML Hide Element HTML Nested Table HTML Reset Button What does HTML stand for? HTML Background Image HTML Tag Div Tag in HTML How to insert Image in HTML How to create a link with no underline in HTML How to insert spacestabs in text using HTMLCSS HTML tag HTML Code HTML Tag HTML Canvas Design a tribute page using HTML and CSS What is a Container tag Font tag in HTML Difference between HTML and DHTML Empty Tag in HTML HTML Button Link Html Line Break Img src HTML Nested List in HTML Placeholder in HTML TD in HTML HTML Space Code HTML Target Attribute HTML Tag Markup Meaning in HTML Border-Collapse in HTML HTML Onclick Online HTML Compiler Convert HTML to PDF HTML Formatter HTML5 - Web Storage HTTP – Responses Container Tag in HTML DL Tag in HTML Horizontal Rule HTML HTML Tab Text Html Table Cell Background Color HTML Table Cell Color HTML Col Width How Many HTML Tags are There Convert String to Unicode Characters in Python HTML Runner HTML Style Attribute HTML Superscript Attribute HTML tabindex Marquee Tag in HTML HTML Dynamic Form HTML side Tag HTML Pattern Attribute HTML q Tag HTML Readonly Base 64 Encoding in HTML Documents Enhancing Data Portability and Security Evo Cam Web Cam HTML Free code camp HTML CSS How to Add a JS File in HTML? How to Add Picture in HTML How to Add the Logo in HTML? How to Add Video in HTML HTML Class Attribute HTML Entities HTML Form Elements HTML Form Templates HTML Marquee Tag HTML Radio Buttons HTML Text box HTML to JSX HTML Tooltip Basic HTML Codes How to Align Image Center in HTML HTML Header Tag HTML Image Tag HTML Next Line

How to Change Font Color in HTML?

What is HTML?

HTML is a common markupmarkup language used as a foundation of every webpage we see online. Thus, HTML is a markup language that is used by all web pages. HTML documents consist of tags that arrange and structure their content. This block is a basic block that is responsible for organizing the page and includes the layout elements, adding headers, paragraphs, links, pictures, and lists to the site's main content. HTML tags are a secondary culprit that reveals the concept of HTML and sometimes the structure behind it, hence playing the role of the marquee tool.

HTML web pages should be arranged in blocks, which include nested components that can be different the content or some other feature. The sample HTML document containing one of the most basic metadata elements (like the title, character encoding, etc) will probably be rather easy to write.

How to Change Font Color in HTML?

In HTML, changing the font color of text is a standard stylistic approach for improving the visual appearance of online pages. Cascading Style Sheets, or CSS, is used to do this. It lets you specify different styles for your HTML components. Using the color property is one of the easiest ways to alter the font's color. Color names, HEX codes, RGB values, and HSL values are among the many color values that may be entered into this parameter.

 You can use external stylesheets, internal styles, or inline styles to apply the color attribute to an HTML element. The style property applies inline styles directly to the HTML element. The HTML document's section has the tag; external stylesheets are independent CSS files connected to the HTML content. By giving the color attribute the required color value, you may alter the text's font color to better fit your design specifications.

Methods to Change Font Color

1. Using color keyword:

    One easy technique to change the font color of text in HTML and CSS is to use color keywords. Color keywords make it simple to apply common colors to components, such as red, blue, green, and so forth. For instance, you may use the color property in the inline style attribute with the value red to render the text of a paragraph read:

     Example:

    <p style="color: red;">This text will be red.</p>

    2. Using HEX codes:

     HEX codes in HTML and CSS allow you to define colors with great precision. HEX codes are two-digit hexadecimal numbers between 00 and FF that are used to indicate colors. They are commonly written in the pattern #RRGGBB, where RR stands for red, GG for green, and BB for blue. You have a plethora of options when it comes to decorating your web pages because this format offers over 16 million different colors. For instance, you would use the following CSS to utilize a HEX code to change the font color of a paragraph to a shade of blue:

     Example:

     <p style="color: #00ff00;">This text will be green.</p>

    3. Using RGB/RGBA Values:

     RGB (Red, Green, and Blue) and RGBA (RGB plus Alpha) values are used to describe colors in HTML and CSS. In order to generate a wide spectrum of colors, RGB values indicate the intensity of red, green, and blue colors, each ranging from 0 to 255. Similar to RGB values, RGBA values also have an extra alpha channel that specifies the color's opacity (0 being entirely transparent and 1 being fully opaque). This makes it possible to create semi-transparent colors. For example, you might use {rgb(255, 0, 0)} to generate a totally opaque red color using RGB. Use {rgba(255, 0, 0, 0.5)} to generate a semi-transparent red color with 50% opacity using RGBA.

    4. Using HSL Values:

    Using HSL (Hue, Saturation, and Lightness) and HSLA (HSL plus an alpha channel) values is a versatile technique for describing colors in CSS. Hue (the kind of color), saturation (the intensity of the color), and lightness (the percentage of white or black in color) are the three parameters used by HSL to represent colors. Similar to HSL, HSLA also has an alpha channel that lets you adjust the color's opacity.

    Example:

    <p style="color: hsl(120, 100%, 50%);">This text will be green.</p>

    <p style="color: hsla(240, 100%, 50%, 0.5);">This text will be semi-transparent blue.</p>

    5. Using color names:

    The color names can be used to change the font's color in HTML and CSS. Instead of numeral codes or RGB values, you can use special names based on the color grouping, such as "red," "blue," or "green," for font color picking.

    <p style="color: red;">This text will be red.</p>

    Shaping colors using their names and just hinting at their precise color codes is more convenient for a beginner to apply them. For instance, less skilled users can deal with such basic color selection techniques, as their accuracy will be of different importance than in the case of more advanced color selection. Additionally, you should know that browsers sometimes change the names of colors, so it is good to check your color choice in other browsers to make sure it isn't the reason for having the name changed.

    6. Using Inline CSS:

    The "Style" feature in inline CSS allows a designer to do that directly by separating HTML elements using a different implementation technique. These styles are one way of presenting and styling your items without the need to follow external stylesheets that the company has developed. The benefit of using chrome is that the nature of color shown in style=" color:" can be used to change the color of the text of any element.

    Example:

    <p style="color: red;">This text will be red.</p>

    Here, the color of the font has been set to red, where red is used as the style attribute applied to the <p> tag. Either RGB values (rgb(255, 0, 0)) or hexadecimal color codes(#RRGGBB) can be seen. Color titles (red, blue, green, etc.) and RGBA values(rgba(255, 0, 0, 75%), for instance) are also a thing.

    Inline CSS is a property that helps build a permit style for an element or complete page. In the majority, but not all, cases, external or internal CSS stylesheets should be used for the entire project or when you are going to define styles consistently across different page elements for easier organization and maintenance.

    7. Using Internal CSS:

    The section is usually where CSS code is used to style HTML components directly within the HTML text. This technique is known as internal CSS. With this method, you may style individual or group items on a page more precisely while keeping other pages unaffected. 

    You must first declare the styles inside of a section of your HTML page in order to use internal CSS. You can set the CSS values and attributes to apply to the items you want to use within this tag. For instance, to make every paragraph's text blue, you would type:

    Example:

    <head>

    <style>

        p {

    color: blue;

        }

    </style>

    </head>

    Internal CSS is beneficial for small-scale stylistic changes within a single HTML document. At the same time, external CSS is often suggested for bigger projects to preserve consistency and make managing styles across numerous pages easier.

    8. Using External CSS:

    Text color in HTML may be altered by utilizing an external CSS (Cascading Style Sheets) file. Using this technique, you may link your HTML documents to a separate CSS file that defines the styles so you can keep your styles constant across several web pages. Use an external CSS file to alter the color of text by doing the following steps:

    • Make a CSS file: To begin, create a new CSS file (styles.css, for example) and describe the text color styles therein. For instance, you may use the following CSS code to make paragraph text blue:
    p {

    color: blue;

    }
    • Link the CSS file to your HTML document: Use the tag in the section of your HTML page to link the CSS file to your HTML content. Ensure that the href tag has the right location for your CSS file.
    <head>

    <link rel="stylesheet" type="text/css" href="styles.css">

    </head>
    • Apply the styles: The styles specified in the CSS file will be applied to the HTML elements when the file is linked. The text color of any elements in your HTML document will now be blue. 

    Using an external CSS file for styling makes it easier to make global style changes throughout your website and keeps your HTML code neat and organized.