Skip to content

Commit 82ad59f

Browse files
Enforced casing and fix inconsistent homepage example (#310)
Made a decision about how names should look. Block and elements have no casing guidance so the convention becomes more subjective. Fixes #302 I feel like I should mention that I read through #94 but there wasn't a strong consensus either way Apologies for the double PR, I misspelled the branch name
1 parent 4e60398 commit 82ad59f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/components/CodeSection.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Code } from 'astro/components';
2424
</div>
2525
<div class="relative">
2626
<div class="bg-white text-black absolute right-2 top-2 font-bold py-0 px-2 rounded-md "><span class="bg-clip-text text-transparent bg-gradient-to-r from-blue-500 to-teal-400">BEM</span></div>
27-
<Code lang="scss" theme="dracula-soft" code={`.opinions_box {
27+
<Code lang="scss" theme="dracula-soft" code={`.opinions-box {
2828
margin: 0 0 8px 0;
2929
text-align: center;
3030

src/pages/naming.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Encapsulates a standalone entity that is meaningful on its own. While blocks can
2020

2121
| Naming | HTML | CSS |
2222
| ------ | ---- | --- |
23-
| Block names may consist of Latin letters, digits, and dashes. To form a CSS class, add a short prefix for namespacing: `.block` | Any DOM node can be a block if it accepts a class name. `<div class="block">...</div>` | Use class name selector only. [No tag name or ids](/faq/#why-not-use-ids-or-tagnames). No dependency on other blocks/elements on a page. `.block { color: #042; }` |
23+
| Block names may consist of lowecase Latin letters, digits, and dashes. To form a CSS class, add a short prefix for namespacing: `.block`. Spaces in long block names are replaced by dash. | Any DOM node can be a block if it accepts a class name. `<div class="block">...</div>` | Use class name selector only. [No tag name or ids](/faq/#why-not-use-ids-or-tagnames). No dependency on other blocks/elements on a page. `.block { color: #042; }` |
2424

2525
## Element
2626

2727
Parts of a block and have no standalone meaning. Any element is semantically tied to its block.
2828

2929
| Naming | HTML | CSS |
3030
| ------ | ---- | --- |
31-
| Element names may consist of Latin letters, digits, dashes and underscores. CSS class is formed as block name plus two underscores plus element name: `.block__elem` | Any DOM node within a block can be an element. Within a given block, all elements are semantically equal. | `<div class="block"><span class="block__elem"></span></div>` | Use class name selector only. [No tag name or ids](/faq/#why-not-use-ids-or-tagnames). No dependency on other blocks/elements on a page. |
31+
| Element names may consist of lowecase Latin letters, digits, dashes and underscores. CSS class is formed as block name plus two underscores plus element name: `.block__elem`. Spaces in long element names are replaced by dash. | Any DOM node within a block can be an element. Within a given block, all elements are semantically equal. | `<div class="block"><span class="block__elem"></span></div>` | Use class name selector only. [No tag name or ids](/faq/#why-not-use-ids-or-tagnames). No dependency on other blocks/elements on a page. |
3232

3333
### Good
3434

@@ -49,7 +49,7 @@ Flags on blocks or elements. Use them to change appearance, behavior or state.
4949

5050
| Naming | HTML | CSS |
5151
| ------ | ---- | --- |
52-
| Modifier names may consist of Latin letters, digits, dashes and underscores. CSS class is formed as block’s or element’s name plus two dashes: `.block--mod` or `.block__elem--mod` and `.block--color-black` with `.block--color-red`. Spaces in complicated modifiers are replaced by dash. | Modifier is an extra class name which you add to a block/element DOM node. Add modifier classes only to blocks/elements they modify, and keep the original class. | Use modifier class name as selector: `.block--hidden { }` To alter elements based on a block-level modifier: `.block--mod .block__elem { }` Element modifier: `.block__elem--mod { }` |
52+
| Modifier names may consist of lowecase Latin letters, digits, dashes and underscores. CSS class is formed as block’s or element’s name plus two dashes: `.block--mod` or `.block__elem--mod` and `.block--color-black` with `.block--color-red`. Spaces in complicated modifiers are replaced by dash. | Modifier is an extra class name which you add to a block/element DOM node. Add modifier classes only to blocks/elements they modify, and keep the original class. | Use modifier class name as selector: `.block--hidden { }` To alter elements based on a block-level modifier: `.block--mod .block__elem { }` Element modifier: `.block__elem--mod { }` |
5353

5454
### Good
5555

0 commit comments

Comments
 (0)