네이밍 규칙

Atomic CSS의 핵심 규칙은 단순합니다: CSS 속성과 값의 앞글자를 조합합니다.

기본 규칙

CSS 속성: 값 → 앞글자 조합 = 클래스명
CSS클래스분해
display: flexdfd(isplay) + f(lex)
display: griddgd(isplay) + g(rid)
display: nonednd(isplay) + n(one)
justify-content: centerjccj(ustify)-c(ontent) + c(enter)
align-items: flex-startaifsa(lign)-i(tems) + f(lex)-s(tart)
flex-direction: columnfdcf(lex)-d(irection) + c(olumn)
position: absolutepap(osition) + a(bsolute)
position: stickypsp(osition) + s(ticky)
overflow: hiddenoho(verflow) + h(idden)
white-space: nowrapwsnw(hite)-s(pace) + n(owrap)
text-overflow: ellipsistoet(ext)-o(verflow) + e(llipsis)
cursor: pointercpc(ursor) + p(ointer)
object-fit: coverofco(bject)-f(it) + c(over)

문서에 없는 속성도 같은 규칙으로 추론 가능합니다. 예: table-layout: fixed → tlf, backface-visibility: hidden → bfvh

숫자 값

속성 약어 뒤에 숫자와 단위를 바로 붙입니다:

{속성 약어}{숫자}{단위}
CSS클래스
padding: 16pxp16px
margin-top: 2.4remmt2-4rem
gap: 8pxgap8px
font-size: 1.4remfs1-4rem
width: 50%w50p
height: 100vhh100vh
border-radius: 8pxbr8px
max-width: 80remmaxw80rem
line-height: 1.7lh1-7
letter-spacing: 0.05emls0-05em

하이픈(-) 사용

하이픈은 4가지 용도로 사용됩니다:

용도예시결과
소수점gap1-5remgap: 1.5rem
소수점fs1-4remfont-size: 1.4rem
값 구분 (Grid)gtc1fr-2fr-1frgrid-template-columns: 1fr 2fr 1fr
미디어 쿼리sm-dn@media (max-width: 768px) { display: none }
의사 클래스hover-bg333333:hover { background-color: #333333 }

특수 접미사 / 접두사

i 접미사 — !important

클래스 끝에 i를 붙이면 !important가 추가됩니다:

클래스CSS
w100pxiwidth: 100px !important
dnidisplay: none !important
mt0imargin-top: 0 !important

neg- 접두사 — 음수 값

neg-를 앞에 붙이면 음수 값이 됩니다:

클래스CSS
neg-mt10pxmargin-top: -10px
neg-l5pxleft: -5px
neg-zi5z-index: -5
neg-order1order: -1

중복 구분

같은 약어가 여러 속성에 해당할 경우, 단위 유무로 구분합니다:

클래스CSS이유
fs0flex-shrink: 0단위 없음 → flex-shrink
fs16pxfont-size: 16px단위 있음 → font-size
prposition: relative단위 없음 → position
pr16pxpadding-right: 16px단위 있음 → padding-right

다음 단계

  • 단위 — px, rem, % 단위 규칙
  • 간격 — margin, padding, gap 사용법