Indexed by TopGit from live GitHub metadata: necolas/idiomatic-css has 6.6k stars. Principles of writing consistent, idiomatic CSS.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
The following document outlines a reasonable style guide for CSS development.
These guidelines strongly encourage the use of existing, common, sensible
patterns. They should be adapted as needed to create your own style guide.
This is a living document and new ideas are always welcome. Please
contribute.
Table of contents
General principles
Whitespace
Comments
Format
Practical example
Acknowledgements
License
1. General principles
"Part of being a good steward to a successful project is realizing that
writing code for yourself is a Bad Idea™. If thousands of people are using
your code, then write your code for maximum clarity, not your personal
preference of how to get clever within the spec." - Idan Gazit
Don't try to prematurely optimize your code; keep it readable and
understandable.
All code in any code-base should look like a single person typed it, even
when many people are contributing to it.
Strictly enforce the agreed-upon style.
If in doubt when deciding upon a style use existing, common patterns.
2. Whitespace
Only one style should exist across the entire source of your code-base. Always
be consistent in your use of whitespace. Use whitespace to improve
readability.
Never mix spaces and tabs for indentation.
Choose between soft indents (spaces) or real tabs. Stick to your choice
without fail. (Preference: spaces)
If using spaces, choose the number of characters used per indentation level.
(Preference: 4 spaces)
Tip: configure your editor to "show invisibles" or to automatically remove
end-of-line whitespace.
Tip: use an EditorConfig file (or equivalent) to
help maintain the basic whitespace conventions that have been agreed for your
code-base.
3. Comments
Well commented code is extremely important. Take time to describe components,
how they work, their limitations, and the way they are constructed. Don't leave
others in the team guessing as to the purpose of uncommon or non-obvious
code.
Comment style should be simple and consistent within a single code base.
Place comments on a new line above their subject.
Keep line-length to a sensible maximum, e.g., 80 columns.
Make liberal use of comments to break CSS code into discrete sections.
Use "sentence case" comments and consistent text indentation.
Tip: configure your editor to provide you with shortcuts to output agreed-upon
comment patterns.
Example:
/* ==========================================================================
Section comment block
========================================================================== */
/* Sub-section comment block
========================================================================== */
/**
* Short description using Doxygen-style comment format
*
* The first sentence of the long description starts here and continues on this
* line for a while finally concluding here at the end of this paragraph.
*
* The long description is ideal for more detailed explanations and
* documentation. It can include example HTML, URLs, or any other information
* that is deemed necessary or useful.
*
* @tag This is a tag named 'tag'
*
* TODO: This is a todo statement that describes an atomic task to be completed
* at a later date. It wraps after 80 characters and following lines are
* indented by 2 spaces.
*/
/* Basic comment */
4. Format
The chosen code format must ensure that code is: easy to read; easy to clearly
comment; minimizes the chance of accidentally introducing errors; and results
in useful diffs and blames.
Use one discrete selector per line in multi-selector rulesets.
Include a single space before the opening brace of a ruleset.
Include one declaration per line in a declaration block.
Use one level of indentation for each declaration.
Include a single space after the colon of a declaration.
Use lowercase and shorthand hex values, e.g., #aaa.
Use single or double quotes consistently. Preference is for double quotes,
e.g., content: "".
Quote attribute values in selectors, e.g., input[type="checkbox"].
Where allowed, avoid specifying units for zero-values, e.g., margin: 0.
Include a space after each comma in comma-separated property or function
values.
Include a semi-colon at the end of the last declaration in a declaration
block.
Place the closing brace of a ruleset in the same column as the first
character of the ruleset.
Larger teams may prefer the simplicity and ease-of-maintenance that comes with
alphabetical ordering.
Exceptions and slight deviations
Large blocks of single declarations can use a slightly different, single-line
format. In this case, a space should be included after the opening brace and
before the closing brace.
Long, comma-separated property values - such as collections of gradients or
shadows - can be arranged across multiple lines in an effort to improve
readability and produce more useful diffs. There are various formats that could
be used; one example is shown below.
Different CSS preprocessors have different features, functionality, and syntax.
Your conventions should be extended to accommodate the particularities of any
preprocessor in use. The following guidelines are in reference to Sass.
Limit nesting to 1 level deep. Reassess any nesting more than 2 levels deep.
This prevents overly-specific CSS selectors.
Avoid large numbers of nested rules. Break them up when readability starts to
be affected. Preference to avoid nesting that spreads over more than 20
lines.
Always place @extend statements on the first lines of a declaration
block.
Where possible, group @include statements at the top of a declaration
block, after any @extend statements.
Consider prefixing custom functions with x- or another namespace. This
helps to avoid any potential to confuse your function with a native CSS
function, or to clash with functions from libraries.
Thanks to everyone who has provided translations and to all those who
contributed to idiomatic.js. It was a
source of inspiration, quotations, and guidelines.
License
Principles of writing consistent, idiomatic CSS by Nicolas Gallagher is
licensed under the Creative Commons Attribution 3.0 Unported
License. This applies to all
documents and translations in this repository.
Based on a work at
github.com/necolas/idiomatic-css.
Does necolas/idiomatic-css have a project website?
No homepage URL was recorded for necolas/idiomatic-css in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does necolas/idiomatic-css have any tags?
TopGit's last sync did not record any GitHub topics for necolas/idiomatic-css. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on necolas/idiomatic-css?
The most recent commit recorded on necolas/idiomatic-css was 3.9 years ago, based on the GitHub push timestamp. The repository has 594 forks — one of the better signals of community interest.
How many stars does necolas/idiomatic-css have?
necolas/idiomatic-css has 6.6k GitHub stars — refresh the page for the live number, or check github.com/necolas/idiomatic-css. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is necolas/idiomatic-css open source?
TopGit's metadata for necolas/idiomatic-css does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
Where do I read more about necolas/idiomatic-css?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/necolas/idiomatic-css is the definitive source.
Read full README in the tab above.
Curious whether idiomatic-css is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about idiomatic-css.