HTML body text Attribute
HTML <body> tag
Definition and Usage
The text attribute specifies the color text for a page.
Text includes all text elements (like paragraphs, divs, and headers).
Compatibility Notes
The text attribute of the body element was deprecated in HTML 4.01
and is not supported in XHTML 1.0 Strict DTD.
Use CSS instead.
CSS syntax (in <head>): <style>body{color:red}</style>
In our CSS tutorial you can find more details about the
text color property.
Syntax
<body text="color_value">
|
Syntax Example
Attribute Values
Value |
Description |
color_name |
Specifies the text color with a color name, like "red" |
RGB_value |
Specifies the text color with a RGB value, like "rgb(255,0,0)" |
Hex_value |
Specifies the text color with a hex value, like "#ff0000" |
Browser Support

The attribute is supported in all major browsers.
Example
<html>
<body text="#00008B">
<p>Welcome to W3Schools.</p>
</body>
</html>
|
Try-It-Yourself Demos
body text
attribute example
Set the text color with the body text attribute.
In CSS:
text color example
Set the text color with CSS.
HTML <body> tag
Whether you're new to XML or already an advanced user, the user-friendly views
and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to
meet your XML and Web services development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a fully functional free 30-day trial today!
|