Skip to content

Commit 6cf1970

Browse files
author
hello@cyan.red
committed
Add: example of ordering properties by type
1 parent 4eda012 commit 6cf1970

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

css_architecture.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,43 @@ Ultimately, you have to find a pattern that works for you and your team. The str
442442
/* STATE */
443443
```
444444

445+
Beyond that, you could also select a pattern for organizing the actual properties within the selectors. Though many people don't bother with this at all, some teams find it easier to order them alphabetically. Others prefer grouping properties by "type", for example:
446+
447+
```css
448+
.selector {
449+
/* positioning */
450+
position: absolute;
451+
z-index: 10;
452+
top: 0;
453+
right: 0;
454+
455+
/* display & box model */
456+
display: inline-block;
457+
overflow: hidden;
458+
box-sizing: border-box;
459+
width: 100px;
460+
height: 100px;
461+
padding: 10px;
462+
border: 10px solid #333;
463+
margin: 10px;
464+
465+
/* color */
466+
background: #000;
467+
color: #fff
468+
469+
/* text */
470+
font-family: sans-serif;
471+
font-size: 16px;
472+
line-height: 1.4;
473+
text-align: right;
474+
475+
/* other */
476+
cursor: pointer;
477+
}
478+
```
479+
480+
Given the recommendation to try to separate visual css from positioning css, I would probably lean towards alphabetical or random myself.
481+
445482

446483
## Naming
447484

0 commit comments

Comments
 (0)