TopGit tracks dropbox/css-style-guide on GitHub. The project has 1.2k stars. Dropbox’s (S)CSS authoring style guide
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.
“Every line of code should appear to be written by a single person, no matter the number of contributors.” —@mdo
General
Don’ts
Avoid using HTML tags in CSS selectors
E.g. Prefer .o-modal {} over div.o-modal {}
Always prefer using a class over HTML tags (with some exceptions like CSS resets)
Don't use ids in selectors
#header is overly specific compared to, for example .header and is much harder to override
Read more about the headaches associated with IDs in CSS here.
Don’t nest more than 3 levels deep
Nesting selectors increases specificity, meaning that overriding any CSS set therein needs to be targeted with an even more specific selector. This quickly becomes a significant maintenance issue.
Avoid using nesting for anything other than pseudo selectors and state selectors.
E.g. nesting :hover, :focus, ::before, etc. is OK, but nesting selectors inside selectors should be avoided.
Don't !important
Ever.
If you must, leave a comment, and prioritise resolving specificity issues before resorting to !important.
!important greatly increases the power of a CSS declaration, making it extremely tough to override in the future. It’s only possible to override with another !important declaration later in the cascade.
Don’t use margin-top.
Vertical margins collapse. Always prefer padding-top ormargin-bottom on preceding elements
Avoid shorthand properties (unless you really need them)
It can be tempting to use, for instance, background: #fff instead of background-color: #fff, but doing so overrides other values encapsulated by the shorthand property. (In this case, background-image and its associative properties are set to “none.”
This applies to all properties with a shorthand: border, margin, padding, font, etc.
Spacing
Four spaces for indenting code
Put spaces after : in property declarations
E.g. color: red; instead of color:red;
Put spaces before { in rule declarations
E.g. .o-modal { instead of .o-modal{
Write your CSS one line per property
Add a line break after } closing rule declarations
When grouping selectors, keep individual selectors on a single line
Place closing braces } on a new line
Add a new line at the end of .scss files
Trim excess whitespace
Formatting
All selectors are lower case, hyphen separated aka “spinal case” eg. .my-class-name
Always prefer Sass’s double-slash // commenting, even for block comments
Avoid specifying units for zero values, e.g. margin: 0; instead of margin: 0px;
Always add a semicolon to the end of a property/value declaration
Use leading zeros for decimal values opacity: 0.4; instead of opacity: .4;
Put spaces before and after child selector div > span instead of div>span
Nesting can be really easily avoided by smart class naming (with the help of BEM) and avoiding bare tag selectors.
BEM
Block: Unique, meaningful names for a logical unit of style. Avoid excessive shorthand.
Good: .alert-box or .recents-intro or .button
Bad: .feature or .content or .btn
Element: styles that only apply to children of a block. Elements can also be blocks themselves. Class name is a concatenation of the block name, two underscores and the element name. Examples:
.alert-box__close
.expanding-section__section
Modifier: override or extend the base styles of a block or element with modifier styles. Class name is a concatenation of the block (or element) name, two hyphens and the modifier name. Examples:
.alert-box--success
.expanding-section--expanded
BEM Best practices
Don't @extend block modifiers with the block base.
Good: <div class="my-block my-block--modifier">
Bad: <div class="my-block--modifier">
Don't create elements inside elements. If you find yourself needing this, consider converting your element into a block.
Bad: .alert-box__close__button
Choose your modifiers wisely. These two rules have very different meaning:
Try to use BEM-based naming for your class selectors
When using modifier classes, always require the base/unmodified class is present
Use Sass’s nesting to manage BEM selectors like so:
.block {
&--modifier { // compiles to .block--modifier
text-align: center;
}
&__element { // compiles to .block__element
color: red;
&--modifier { // compiles to .block__element--modifier
color: blue;
}
}
}
Namespaced Classes
There are a few reserved namespaces for classes to provide common and globally-available abstractions.
.o- for CSS objects. Objects are usually common design patterns (like the Flag object). Modifying these classes could have severe knock-on effects.
.c- for CSS components. Components are designed pieces of UI—think buttons, inputs, modals, and banners.
.u- for helpers and utilities. Utility classes are usually single-purpose and have high priority. Things like floating elements, trimming margins, etc.
.is-, .has- for stateful classes, a la SMACSS. Use these classes for temporary, optional, or short-lived states and styles.
._ for hacks. Classes with a hack namespace should be used when you need to force a style with !important or increasing specificity, should be temporary, and should not be bound onto.
.t- for theme classes. Pages with unique styles or overrides for any objects or components should make use of theme classes.
Separation of Concerns (One Thing Well™)
You should always try to spot common code—padding, font sizes, layout patterns—and abstract them to reusable, namespaced classes that can be chained to elements and have a single responsibility. Doing so helps prevent overrides and duplicated rules, and encourages a separation of concerns.
Does dropbox/css-style-guide have a project website?
No homepage URL was recorded for dropbox/css-style-guide in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does dropbox/css-style-guide have any tags?
TopGit's last sync did not record any GitHub topics for dropbox/css-style-guide. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on dropbox/css-style-guide?
The most recent commit recorded on dropbox/css-style-guide was 6.8 years ago, based on the GitHub push timestamp. The repository has 82 forks — one of the better signals of community interest.
How many stars does dropbox/css-style-guide have?
dropbox/css-style-guide has 1.2k GitHub stars — refresh the page for the live number, or check github.com/dropbox/css-style-guide. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is dropbox/css-style-guide written in?
TopGit's last sync did not record a primary language for dropbox/css-style-guide. Open the repository on GitHub to see the full breakdown by file extension.
Where do I read more about dropbox/css-style-guide?
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/dropbox/css-style-guide is the definitive source.
Read full README in the tab above.
Want a second opinion on css-style-guide?
Ask an AI that can read this page — one click and you get its take on css-style-guide.