Besides inline styles, you also can use the HTML <STYLE> element to set styles for a document, creating an embedded style sheet . This element usually goes in a web page's head; here's an example, where I'm setting the style of the <BODY> , making it display white text on a black background, and <P> elements, making them display italicized text, in a document: (Listing 21-01.html on the web site)<HTML> <HEAD> <TITLE>Using the <STYLE> Element</TITLE> <STYLE TYPE="text/css"> BODY {background: black; color: white} P {font-style: italic} </STYLE> </HEAD> <BODY> <H1> Using the <STYLE> Element </H1> <P> This text is italic. </P> </BODY> </HTML> You can see the results in Figure 21.1. Figure 21.1. Using the <STYLE> element.
|