CSS comments looks

CSS comments look like this: /* this is a comment */, and can be single-line or multipleline.  In the advanced CSS boilerplate, a multiline comment is used for an introduction and table of contents:
/*
STYLE SHEET FOR [WEB SITE]
Created by [AUTHOR NAME]
[URL OF AUTHOR]
ToC
1. defaults
2. structure
3. links and navigation
4. fonts
5. images
Notes
*/
Each section of the document is then headed by a lengthy comment that makes it obvious  when a section has begun:
/* ——— 1. defaults ——— */
* {
margin: 0;
padding: 0;
}
body {
}
As you can see, property/value pairs and the closing curly bracket are indented by two tabs in the document (represented by two spaces on this page), which makes it easier to scan vertically through numerous selectors. (Note that for the bulk of this book, the rules aren’t formatted in this way, because indenting only the property/value pairs differentiates them more clearly in print; however, the download files all have CSS rules indented as per the recommendations within this section.) Comments can also be used for subheadings, which I tend to indent by one tab:
/* float-clearing rules */
.separator {
clear: both;
}
Although the bulk of the style sheet’s rules are empty, just having a boilerplate to work from saves plenty of time in the long run, ensuring you don’t have to key in the same defaults time and time again. Use the one from the download files as the basis for your own, but if you regularly use other elements on a page (such as pull quotes), be sure to add those, too—after all, it’s quicker to amend a few existing rules to restyle them than it is to key them in from scratch.

Along the same lines as boilerplates, you can save time by creating a snippets folder on your hard drive. Use it to store snippets of code—HTML elements, CSS rules, and so on—that you can reuse on various websites. Many applications have this functionality built in, so make use of it if your preferred application does.

  • Share/Bookmark

Related posts:

  1. CSS Syntax & Syntax Details CSS syntax is easy. A stylesheet contains styles; a style...
  2. The rules of CSS Style sheets consist of a number of rules that define...

Related posts brought to you by Yet Another Related Posts Plugin.

Filed Under: CSS Basic

Tags:

About the Author: I am designer and want to learn CSS

RSSComments (0)

Trackback URL

Leave a Reply

You must be logged in to post a comment.