YouTip LogoYouTip

Att Basefont Color

# HTML color Attribute The `color` attribute of the `` tag was used in older versions of HTML to specify a default text color for an entire document. --- ## Deprecation Notice > ⚠️ **Important:** The `` tag and its `color` attribute are **deprecated** in HTML 4.01 and are **not supported** in HTML5. Modern web development practices require using CSS to set default text colors. --- ## Browser Support | Attribute | Internet Explorer | Firefox | Opera | Chrome | Safari | | :--- | :--- | :--- | :--- | :--- | :--- | | **color** | Supported (IE 9 and earlier only) | Not supported | Not supported | Not supported | Not supported | *Note: Only Internet Explorer 9 and earlier versions support the `` tag and its `color` attribute.* --- ## Definition and Usage The `color` attribute specifies the default text color for all the text in an HTML document (unless overridden by other style declarations). Because this attribute is deprecated, you should use CSS instead to define the default text color for your page. ### Modern CSS Alternative To set a default text color for your entire page using CSS, apply the `color` property to the `` element inside your stylesheet: ```html

This is a header

This is a paragraph

``` --- ## Syntax ```html ``` ## Attribute Values | Value | Description | Example | | :--- | :--- | :--- | | *color_name* | Specifies the font color using a color name. | `color="red"` | | *hex_number* | Specifies the font color using a hexadecimal value. | `color="#ff0000"` | | *rgb_number* | Specifies the font color using an RGB value. | `color="rgb(255,0,0)"` | --- ## Code Examples ### Legacy HTML Example (Deprecated) The following example demonstrates how the `color` attribute was used in legacy HTML documents to set the default text color to red. ```html

This is a header

This is a paragraph

``` ### Recommended Modern CSS Example This is the modern, standards-compliant way to achieve the same visual result using CSS. ```html Setting Default Text Color with CSS

This is a header

This is a paragraph

``` --- ## Compatibility Notes * **HTML 4.01:** The `color` attribute of the `` element is deprecated. * **XHTML 1.0 Strict:** The `` element and its `color` attribute are not supported. * **HTML5:** The `` element is completely obsolete. Use CSS instead.
← Att Basefont FaceAtt Base Target β†’