X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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>
document.write("The text color is: ")
document.write(document.getElementById("w3s").text);
</script>

</body>
</html>

Try it yourself »


Body Object Reference Body Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook