• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

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> 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint