Latest web development tutorials

HTML body text attributes

HTML body tag Reference Manual HTML <body> tag

Examples

Set HTML text in the document colors:

<h1>Hello world!</h1>
<p>这是一些文本。</p>
<p><a href="http://www.w3big.com/">访问 w3big.com!</a></p>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the text attribute.


Definition and Usage

HTML5 is no longer supported <body> text attributes. Use CSS instead.

<Body> of text attributes in HTML 4.01. Has been abandoned. in HTML 4.01.

text attribute specifies the text color of the HTML document.


Compatibility Notes

In HTML 4.01 deprecated text attribute of the body element; in XHTML 1.0 Strict DTD not supported text attributes of the body element. Use CSS instead.

CSS syntax (<head> section): <style> body {color: green} </ style>

CSS Example: set the color of text in a document

In our CSS tutorial you can find more information about the text color attribute knowledge.


grammar

<body text="color_name|hex_number|rgb_number">

Property Value

value description
color_name Predetermined color is the color of the font color name (such as "red").
hex_number Predetermined color value is a hexadecimal value of font color (eg "# ff0000").
rgb_number Rgb color code is specified font color (such as "rgb (255,0,0)").


HTML body tag Reference Manual HTML <body> tag