Adding Comments to CSS


Like any other part of an HTML document, style sheets can have comments. A comment does not affect code; comments only add notes or give guidance to anyone viewing your code. You can include comments in the style element in the head of an HTML document or in an external CSS file, as shown in Code 2.29.

Code 2.29. You can use comments to add useful notes to a page without interfering with the code.

[View full width]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CSS, DHTML &amp; Ajax | CSS Comments</title> <style media="screen" type="text/css"> /* Sets the general apperance of code tags */ code { font-family: monaco,courier,monospace; font-size: 10pt; line-height: 12pt; margin-left: 2em; } /* While this sets the apperance of special cases for code selector= HTML tags rule= the CSS Rule that defines the apperance comment= Comments in the CSS */ code.selector { color: #009900;} code.rule { color: #990099;} code.comment { color: #cc0000;} </style> </head> <body> <code >/* While this sets the apperance of special cases for code<br /> selector= HTML tags<br /> rule= the CSS Rule that defines the apperance<br /> comment= Comments in the CSS */<br /> </code><br /> <code >code.selector { </code> <code > color: #009900;</code>  <code >}</code><br /> <code >code.rule { </code> <code >color: #990099;</code> <code  >}</code><br /> <code >code.comment {</code> <code >color: #cc0000;</code>  <code >}</code> </body></html>

To include comments in a style sheet:

1.

/*


To open a comment area in a style sheet, type a slash (/) and an asterisk (*).

2.

selector= HTML tags


Type your comments. You can use any letters or numbers, symbols, and even line breaks (by pressing the Return or Enter key).

3.

*/


Close your comment by typing an asterisk (*) and a slash (/).

Tip

  • You cannot nest comments.





CSS, DHTML and Ajax. Visual QuickStart Guide
CSS, DHTML, and Ajax, Fourth Edition
ISBN: 032144325X
EAN: 2147483647
Year: 2006
Pages: 230

Similar book on Amazon

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