Page 63 - CA_165_V2.0_Flipbook
P. 63
The output of the preceding HTML code is as follows:
Colour appears on the background of the webpage
due to <BODY BGCOLOR = "lightblue"> or <BODY
BGCOLOR = "#ADD8E6"> tag.
TEXT Attribute
The TEXT attribute allows you to set a single colour for all the text on the web page. It accepts a color
name or a hexadecimal color code . If no text attribute is specified, the default text color is black. The
syntax for using the TEXT attribute with the <BODY> tag is as follows:
<BODY TEXT = "COLOUR NAME">
OR
<BODY TEXT ="#RRGGBB">
For example:
<BODY TEXT = "RED" >
OR
<BODY TEXT ="#ff0000">
Notes
The TEXT attribute is not supported in HTML5.
The following HTML code uses the COLOR attribute to change the color of the text:
<HTML>
<HEAD>
<TITLE>
Example of text attribute in HTML.
</TITLE>
</HEAD>
<BODY TEXT="RED">
Welcome to this web page. this page demonstrates how to use the text attribute
in the body tag to set text color.
</BODY>
</HTML>
Introduction to HTML 61

