|
|
Cascading Style Sheets: HTML and CSS CSS Comments
CSS also allows for comments, but it uses a completely different
syntax to accomplish this. CSS comments are very similar to C/C++ comments, in
that they are surrounded by
Comments can span multiple lines, just as in C++:
It's important to remember that CSS comments cannot be nested. So, for example, this would not be correct:
However, it's hardly ever desirable to nest comments, so this limitation is no big deal. If you wish to place comments on the same line as markup, then you need to be careful about how you place them. For example, this is the correct way to do it:
Given this example, if each line isn't marked off, then most of the style sheet will become part of the comment, and so will not work:
In this example, only the first rule ( Moving on with our example, we see some more CSS information actually found inside an HTML tag! Inline Styles
For cases where you want to simply assign a few styles to one
individual element, without the need for embedded or external style sheets,
you'll employ the HTML attribute The syntax of a SummaryIn order to facilitate a return to structural HTML, something was needed to permit authors to specify how a document should be displayed. CSS fills that need very nicely, and far better than the various presentational HTML elements ever did (or probably could have done). For the first time in years, there is hope that web pages can become more structural, not less, and at the same time the promise that they can have a more sophisticated look than ever before. In order to ensure that this transition goes as smoothly as possible, HTML introduces a number of ways to link HTML and CSS together while still keeping them distinct. This allows authors to simplify document appearance management and maximize their effectiveness, thereby making their jobs a little easier. The further benefits of improving accessibility and positioning documents for a switch to an XML world make CSS a compelling technology. As for user agent support, the In order to fully understand how CSS can do all of this, authors need a firm grasp of how CSS handles document structure, how one writes rules that behave as expected, and most of all, what the "Cascading" part of the name really means. Return to JavaScript DevCenter. |
|
|
|
|
||||||||