English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The text attribute specifies the text color of the HTML document.
Specify the color of the text in the HTML document as red:
<!DOCTYPE html> <html> <head> <title>HTML:<body> text attribute</title> - 基础教程网 oldtoolbag.com</title>/title> <body text="red"> <h1>Hello world!</h1>/h1> <p>This is some text.</p>/p> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the text attribute.
HTML5 no longer supports the <body> text attribute. Please use CSS instead.
The text attribute of <body> in HTML 4.01is deprecated. in HTML 4.01.
The text attribute specifies the text color of the HTML document.
In HTML 4.01 It is not recommended to use the text attribute of the body element; in XHTML 1In .0 Strict DTD, the text attribute of the body element is not supported. Please use CSS instead.
CSS Syntax (<head> section): <style>body{color:green}</style>/style>
CSS Example: Set text color in the document
In our CSS tutorial, you can find more about text color attribute Knowledge.
<body text="color_name|hex_number|rgb_number">
Value | Description |
---|---|
color_name | Specifies the font color with a color name (for example, "red"). |
hex_number | Specifies the font color with a hexadecimal value (for example, "#ff0000"). |
rgb_number | Specifies the font color with an rgb code (for example, "rgb("255)( |