Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
update to add BEM section
Browse files Browse the repository at this point in the history
  • Loading branch information
mindreeper2420 authored and Adam Jolicoeur committed Jun 27, 2017
1 parent 39629b7 commit ea3038d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions code-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,46 +437,46 @@ Always use classes - avoid using an ID. Use classes over generic element tag for

```

<!-- ### BEM
### BEM

PatternFly follows the [BEM methodology](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/). It's a way to decouple CSS from HTML, and modularize class names so they can be extended.
OpenShift.io follows the [BEM methodology](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/). It's a way to decouple CSS from HTML, and modularize class names so they can be extended.

Class name structure follows the `{{pf-block}}__{{element}}--{{modifier}}` structure:
Class name structure follows the `{{io-block}}__{{element}}--{{modifier}}` structure:

```less
.pf-block__element--modifier {}
.io-block__element--modifier {}
```

Example:

```html
<div class="pf-panel pf-panel--collapsible">
<div class="pf-panel__title">
<div class="io-panel pf-panel--collapsible">
<div class="io-panel__title">
<h1>Heading</h1>
</div>

<div class="pf-panel__content">
<div class="io-panel__content">
<p>Lorem ipsum dolor sit amet.</p>
</div>
</div>
```

```less
.pf-panel {} // Block
.pf-panel--collapsible {} // Modifier of block
.io-panel {} // Block
.io-panel--collapsible {} // Modifier of block

.pf-panel__title {} // Element
.io-panel__title {} // Element

.pf-panel__content {} // Element
.pf-panel__content--unpadded {} // Modifier of element
.io-panel__content {} // Element
.io-panel__content--unpadded {} // Modifier of element
```

**Why it’s better**

- All the selectors have same specificity.
- Every element is defined via a block.
- Every modifier is defined via a block or element.
- Each class name imparts structural info without binding to exact HTML. -->
- Each class name imparts structural info without binding to exact HTML.

<!-- ============================================================ -->

Expand Down

0 comments on commit ea3038d

Please sign in to comment.