-
Notifications
You must be signed in to change notification settings - Fork 0
CSS Style Guide
Adapted from the Google HTML/CSS Style Guide and Dropbox (S)CSS Style Guide.
For generic rules applicable to both HTML and CSS, see General HTML/CSS Style Guide.
NOTE: All CSS in this project is "compiled" from SCSS, an extension of CSS which provides vastly improved levels of understandability and code efficiency. For more information, see their website.
Never use !important declarations. Ever.
If you really need to override a CSS selector, you can utilize CSS selector specificity. See this Smashing Magazine article for more information.
Use meaningful names, but not overly generic names for CSS IDs/classes, or you'll run into issues with declaring styles for the same class repeatedly over the entire project.
/* Not recommended */
.atr {}
/* Recommended */
.attribution {}Use only lower-case letters in ID/class names, separate words using hyphens only.
/* Not recommended */
#imagecomments {}
.image_comment {}
/* Recommended */
#image-comments-container {}
.image-comment {}Preferably you would use CSS "specificity" features to determine what page/container an item is inside, thus making it possible to use more generic names for classes/ids instead of "image-comments-container-item" or something absurdly long like that.
Unless absolutely necessary, do not use element names in conjunction with IDs or classes for performance reasons.
/* Not recommended */
ul#example {}
div.error {}
/* Recommended */
#example {}
.error {}Use shorthand properties (e.g. font instead of separating the properties into font-size, font-weight, etc.)
/* Not recommended */
border-top-style: none;
font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 100%;
line-height: 1.6;
padding-bottom: 10px;
padding-left: 5px;
padding-right: 5px;
padding-top: 0;
/* Recommended */
border-top: 0;
font: 100%/1.6 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 0 5px 10px;Do not use units after 0 values unless they are required.
margin: 0;
padding: 0;Use three characters instead of two for hexadecimal notation if possible. Also use lower case letters for color codes.
/* Not recommended */
color: #FFFFFF;
/* Recommended */
color: #fff;Organize properties in alphabetical order to achieve consistent, easily-maintainable code.
background: #ffffff;
border: 1px solid;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
color: black;
text-align: center;
text-indent: 2em;/* Not recommended */
.footer-item {
padding:10px;
}
/* Recommended */
.footer-item {
padding: 10px;
}Always use a single space between the selector(s) and the opening brace that begins the declaration block. The opening brace should be on the same line as the last selector in a given rule.
/* Not recommended */
#example{
margin: 1px;
}
#example
{
margin: 1px;
}
/* Recommended */
#example {
margin: 1px;
}Always start a new line for each selector and declaration.
/* Not recommended */
a:focus, a:active {
position: relative; top: 1px;
}
/* Recommended */
a:focus,
a:active {
position: relative;
top: 1px;
}Use single-quotes instead of double-quotes for CSS declarations.
/* Not recommended */
html {
font-family: "Open Sans", Arial, sans-serif;
}
/* Recommended */
html {
font-family: 'Open Sans', Arial, sans-serif;
}Leave all CSS as lower-case, except for font names.
/* Not recommended */
#example {
font-family: 'open sans', arial, sans-serif;
font-size: 1.6EM;
}
/* Recommended */
html {
font-family: 'Open Sans', Arial, sans-serif;
font-size: 1.6em;
}Style Guides
Features
- Frontpage
- About pages
- Help pages
- Uploading Images
- Image pages
- Image comments
- Image search
- Image tagging
- Image collections
- Curating collections
- Creators
- Commissions
- Image of the Day
- Favorites
- User profiles
- User settings
- Error messages
- Reporting
- Admin console
- API
- Notifications
Mockups
Roadmap
Notes