Skip to content

Instantly share code, notes, and snippets.

@mejarc
Created October 17, 2011 16:34
Show Gist options
  • Save mejarc/1293028 to your computer and use it in GitHub Desktop.
Save mejarc/1293028 to your computer and use it in GitHub Desktop.
Jonathan Snook's stylesheet template
/**
* based on "Scalable and Modular Architecture for CSS," by Jonathan Snook: http://smacss.com/book/
* Rules for rendering efficiency: use child selectors, avoid tag selectors, and use class names for the right-most selector.
* Rules listed in this order: 1) Box, 2) Border, 3) Background, 4) Text, 5) Other
*/
/**
* Base. Default rules for elements;
* no class or ID selectors;
* how that element should look in all occurrences on the page.
*/
body {
/* margin, padding, background, font, color */
}
a:link {
/* color, text-decoration, transition, font */
}
a:visited {
/* color, text-decoration */
}
a:hover {
/* color, text-decoration */
}
/* rules for h1-h6, other html elements */
/**
* Layout. If using HTML<5, it's not necessary to use element selectors with a Layout style.
* the only primary category type to use ID selectors
*/
/* HTML5: header, nav, footer, article, aside, and so on. */
header {
/* padding, width, height, margin, background, text-shadow */
}
/**
* Third Party
*/
/* for example,
#disqus_thread {
padding: 10px 20px;
border: 1px solid #CCC;
background-color: rgba(0,0,0,.1);
}
*/
/***
* Modules, which sit inside Layout components.
* can sometimes sit within other Modules
* each Module should be designed to exist as a standalone component
* use class names, avoid using IDs and element selectors
* sub-class the module for reuse in other contexts.
*/
.module {
/* width, float, padding, and so on */
}
/***
* State. For instance, pseudo-selectors and media queries, and CSS animations.
*/
.module:first-letter {
}
/* Whither fonts? Themes?
* handled by separate stylesheets
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment