3.6. CSS Comments

More than likely, you are familiar with the concept of comments in HTML:

<!-- this is an HTML comment -->

Comments allow you to include explanations and reminders within your code. These are entirely ignored by the browser, and are normally included solely for the developer's convenience. If you've ever had to make changes to code that hasn't been touched in a few months, I'm sure you can appreciate the value of a few well-placed comments that remind you of how it all works.

CSS has its own syntax for comments. In HTML, a comment begins with <!-- and ends with -->. In CSS, a comment begins with /* and ends with */:

<style type="text/css">
/* This rule makes all text red by default.
   We include paragraphs and table cells for
   older browsers that don't inherit properly. */
body, p, td, th {
  color: red;
}
</style>

If you know much JavaScript, you'll recognize this syntax, which can be used to create multiline comments in that language as well. Unlike JavaScript, however, CSS does not support the single-line double-slash (//) comment style.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.27.244