document.tags.color

JavaScript 1.2+ Nav4+ Syntax

document.tags.tagName.color

Description

The color property specifies the foreground color of an element as associated with the tag called tagName.

Example

Listing 7.173 uses the color property to set the color of various text.

Listing 7.173 Set the Color of Text Using the color Property
<html>

<script>
<!-- Hide

//Create a style sheet tags that defines colors
document.tags.I.color = "blue";
document.tags.B.color = "red";

//Hide End --->
</script>

<i>The blue boat floated on the blue ocean.</i>
<b>The red car stopped at a red stop sign.</b>

</html>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.