Embedded Style Sheets


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 &lt;STYLE&gt; Element</TITLE>  <STYLE TYPE="text/css">   BODY {background: black; color: white}   P {font-style: italic}   </STYLE>  </HEAD>      <BODY>          <H1>              Using the &lt;STYLE&gt; 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.

graphics/21fig01.gif



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net