Skip to content

Commit a93d00e

Browse files
Vince SurianiVince Suriani
authored andcommitted
Made TB specific
1 parent 015a055 commit a93d00e

File tree

1 file changed

+6
-82
lines changed

1 file changed

+6
-82
lines changed

README.md

Lines changed: 6 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Airbnb CSS / Sass Styleguide
1+
# Toll Brothers' CSS / Sass Styleguide
22

33
*A mostly reasonable approach to CSS and Sass*
44

@@ -11,24 +11,20 @@
1111
1. [CSS](#css)
1212
- [Formatting](#formatting)
1313
- [Comments](#comments)
14-
- [OOCSS and BEM](#oocss-and-bem)
1514
- [ID Selectors](#id-selectors)
1615
- [JavaScript hooks](#javascript-hooks)
1716
- [Border](#border)
1817
1. [Sass](#sass)
19-
- [Syntax](#syntax)
2018
- [Ordering](#ordering-of-property-declarations)
2119
- [Variables](#variables)
2220
- [Mixins](#mixins)
23-
- [Extend directive](#extend-directive)
2421
- [Nested selectors](#nested-selectors)
25-
1. [Translation](#translation)
2622

2723
## Terminology
2824

2925
### Rule declaration
3026

31-
A rule declaration is the name given to a selector (or a group of selectors) with an accompanying group of properties. Here's an example:
27+
A "rule declaration" is the name given to a selector (or a group of selectors) with an accompanying group of properties. Here's an example:
3228

3329
```css
3430
.listing {
@@ -39,7 +35,7 @@ A “rule declaration” is the name given to a selector (or a group of selector
3935

4036
### Selectors
4137

42-
In a rule declaration, selectors are the bits that determine which elements in the DOM tree will be styled by the defined properties. Selectors can match HTML elements, as well as an element's class, ID, or any of its attributes. Here are some examples of selectors:
38+
In a rule declaration, "selectors" are the bits that determine which elements in the DOM tree will be styled by the defined properties. Selectors can match HTML elements, as well as an element's class, ID, or any of its attributes. Here are some examples of selectors:
4339

4440
```css
4541
.my-element-class {
@@ -66,9 +62,9 @@ Finally, properties are what give the selected elements of a rule declaration th
6662

6763
### Formatting
6864

69-
* Use soft tabs (2 spaces) for indentation
65+
<!-- * Use soft tabs (2 spaces) for indentation -->
7066
* Prefer dashes over camelCasing in class names.
71-
- Underscores and PascalCasing are okay if you are using BEM (see [OOCSS and BEM](#oocss-and-bem) below).
67+
<!-- - Underscores and PascalCasing are okay if you are using BEM (see [OOCSS and BEM](#oocss-and-bem) below). -->
7268
* Do not use ID selectors
7369
* When using multiple selectors in a rule declaration, give each selector its own line.
7470
* Put a space before the opening brace `{` in rule declarations
@@ -113,63 +109,10 @@ Finally, properties are what give the selected elements of a rule declaration th
113109
- Uses of z-index
114110
- Compatibility or browser-specific hacks
115111

116-
### OOCSS and BEM
117-
118-
We encourage some combination of OOCSS and BEM for these reasons:
119-
120-
* It helps create clear, strict relationships between CSS and HTML
121-
* It helps us create reusable, composable components
122-
* It allows for less nesting and lower specificity
123-
* It helps in building scalable stylesheets
124-
125-
**OOCSS**, or “Object Oriented CSS”, is an approach for writing CSS that encourages you to think about your stylesheets as a collection of “objects”: reusable, repeatable snippets that can be used independently throughout a website.
126-
127-
* Nicole Sullivan's [OOCSS wiki](https://github.com/stubbornella/oocss/wiki)
128-
* Smashing Magazine's [Introduction to OOCSS](http://www.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/)
129-
130-
**BEM**, or “Block-Element-Modifier”, is a _naming convention_ for classes in HTML and CSS. It was originally developed by Yandex with large codebases and scalability in mind, and can serve as a solid set of guidelines for implementing OOCSS.
131-
132-
* CSS Trick's [BEM 101](https://css-tricks.com/bem-101/)
133-
* Harry Roberts' [introduction to BEM](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/)
134-
135-
We recommend a variant of BEM with PascalCased “blocks”, which works particularly well when combined with components (e.g. React). Underscores and dashes are still used for modifiers and children.
136-
137-
**Example**
138-
139-
```jsx
140-
// ListingCard.jsx
141-
function ListingCard() {
142-
return (
143-
<article class="ListingCard ListingCard--featured">
144-
145-
<h1 class="ListingCard__title">Adorable 2BR in the sunny Mission</h1>
146-
147-
<div class="ListingCard__content">
148-
<p>Vestibulum id ligula porta felis euismod semper.</p>
149-
</div>
150-
151-
</article>
152-
);
153-
}
154-
```
155-
156-
```css
157-
/* ListingCard.css */
158-
.ListingCard { }
159-
.ListingCard--featured { }
160-
.ListingCard__title { }
161-
.ListingCard__content { }
162-
```
163-
164-
* `.ListingCard` is the “block” and represents the higher-level component
165-
* `.ListingCard__title` is an “element” and represents a descendant of `.ListingCard` that helps compose the block as a whole.
166-
* `.ListingCard--featured` is a “modifier” and represents a different state or variation on the `.ListingCard` block.
167-
168112
### ID selectors
169113

170114
While it is possible to select elements by ID in CSS, it should generally be considered an anti-pattern. ID selectors introduce an unnecessarily high level of [specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) to your rule declarations, and they are not reusable.
171115

172-
For more on this subject, read [CSS Wizardry's article](http://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/) on dealing with specificity.
173116

174117
### JavaScript hooks
175118

@@ -178,7 +121,7 @@ Avoid binding to the same class in both your CSS and JavaScript. Conflating the
178121
We recommend creating JavaScript-specific classes to bind to, prefixed with `.js-`:
179122

180123
```html
181-
<button class="btn btn-primary js-request-to-book">Request to Book</button>
124+
<button class="btn btn-primary js-contact-form">Contact Us</button>
182125
```
183126

184127
### Border
@@ -203,11 +146,6 @@ Use `0` instead of `none` to specify that a style has no border.
203146

204147
## Sass
205148

206-
### Syntax
207-
208-
* Use the `.scss` syntax, never the original `.sass` syntax
209-
* Order your regular CSS and `@include` declarations logically (see below)
210-
211149
### Ordering of property declarations
212150

213151
1. Property declarations
@@ -259,9 +197,6 @@ Prefer dash-cased variable names (e.g. `$my-variable`) over camelCased or snake_
259197

260198
Mixins should be used to DRY up your code, add clarity, or abstract complexity--in much the same way as well-named functions. Mixins that accept no arguments can be useful for this, but note that if you are not compressing your payload (e.g. gzip), this may contribute to unnecessary code duplication in the resulting styles.
261199

262-
### Extend directive
263-
264-
`@extend` should be avoided because it has unintuitive and potentially dangerous behavior, especially when used with nested selectors. Even extending top-level placeholder selectors can cause problems if the order of selectors ends up changing later (e.g. if they are in other files and the order the files are loaded shifts). Gzipping should handle most of the savings you would have gained by using `@extend`, and you can DRY up your stylesheets nicely with mixins.
265200

266201
### Nested selectors
267202

@@ -288,14 +223,3 @@ Again: **never nest ID selectors!**
288223

289224
If you must use an ID selector in the first place (and you should really try not to), they should never be nested. If you find yourself doing this, you need to revisit your markup, or figure out why such strong specificity is needed. If you are writing well formed HTML and CSS, you should **never** need to do this.
290225

291-
## Translation
292-
293-
This style guide is also available in other languages:
294-
295-
- ![tw](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Taiwan.png) **Chinese (Traditional)**: [ArvinH/css-style-guide](https://github.com/ArvinH/css-style-guide)
296-
- ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) **Chinese (Simplified)**: [Zhangjd/css-style-guide](https://github.com/Zhangjd/css-style-guide)
297-
- ![ja](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Japan.png) **Japanese**: [nao215/css-style-guide](https://github.com/nao215/css-style-guide)
298-
- ![ko](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/South-Korea.png) **Korean**: [CodeMakeBros/css-style-guide](https://github.com/CodeMakeBros/css-style-guide)
299-
- ![PT-BR](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Brazil.png) **Portuguese**: [felipevolpatto/css-style-guide](https://github.com/felipevolpatto/css-style-guide)
300-
- ![ru](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Russia.png) **Russian**: [Nekorsis/css-style-guide](https://github.com/Nekorsis/css-style-guide)
301-
- ![es](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Spain.png) **Spanish**: [ismamz/guia-de-estilo-css](https://github.com/ismamz/guia-de-estilo-css)

0 commit comments

Comments
 (0)