W3Schools.com

Body text Property

Body Object Reference Body Object

Definition and Usage

The text property sets or returns the value of the text attribute of the body element.

The text attribute specifies the color of the text in a document.

Syntax

Set the text property:

bodyObject.text="color"

Return the text property:

bodyObject.text

Value Description
color Specifies the text-color. Look at CSS Color Values for a complete list of possible color values


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The text property is supported in all major browsers.


Example

Example

Return the value of the text attribute of the body element:

<html>
<body id="w3s" text="#0000FF">

<script type="text/javascript">
document.write("The text color is: ")
document.write(document.getElementById("w3s").text);
</script>

</body>
</html>

Try it yourself »


Body Object Reference Body Object
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE