Embedding Style Sheets


As with JavaScript, the browser interprets CSS as HTML unless you tell it otherwise. Style tags do for CSS what the script tags do for JavaScript. They tell the browser to treat everything between them as CSS, not HTML:

 <html>   <head>     <title>Page Title</title>     <style type="text/css">       /* The CSS code goes here. */     </style>   </head>   <body>     <!-- The content of the page goes here. -->   </body> </html> 

Also as with JavaScript, place embedded style sheets in the head section of the code.

TIP

Some ancient browsers don't understand script and style tags. These browsers render everything between them as text anyway. While it's difficult to imagine any visitor having anything like an enjoyable modern Web experience when browsing with these antiques, you might want to put HTML comment tags before and after the script or style tags, like this:

 <script language="JavaScript">   <!   > </script> 

Adding comment tags prevents older browsers from displaying the script or code as HTML.




Web Design Garage
Web Design Garage
ISBN: 0131481991
EAN: 2147483647
Year: 2006
Pages: 202
Authors: Marc Campbell

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