Files
2nd/10_Wiki/Topics/Domain_Programming/Frontend/CSS Media Queries.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

4.4 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-css-media-queries CSS Media Queries 10_Wiki/Topics verified self
Media Query
@media
none A 0.9 applied
css
responsive
media-query
frontend
2026-05-10 pending
language framework
CSS none

CSS Media Queries

매 한 줄

"매 viewport / user preference 의 conditional CSS". Media Queries 는 device width, color scheme, motion preference 등 의 condition 의 styling 의 적용. 2026 Container Queries 의 출현 에도 viewport-level adaptation 의 표준.

매 핵심

매 query types

  • Width: min-width, max-width — viewport 크기
  • Orientation: portrait, landscape
  • User preference: prefers-color-scheme, prefers-reduced-motion, prefers-contrast
  • Resolution: min-resolution: 2dppx (Retina)
  • Hover capability: hover: hover vs hover: none
  • Pointer: pointer: fine vs coarse

매 Range syntax (2026 표준)

@media (width >= 768px) { ... }
@media (400px <= width <= 800px) { ... }

매 Mobile-first vs Desktop-first

  • Mobile-first (권장): base = mobile, min-width 의 add — 매 cascade 친화적
  • Desktop-first: base = desktop, max-width 의 override — 매 legacy

매 응용

  1. Responsive breakpoint.
  2. Dark mode (prefers-color-scheme).
  3. Accessibility (prefers-reduced-motion).
  4. Print stylesheet (@media print).
  5. High-DPI image (Retina).

💻 패턴

Mobile-first breakpoints

/* base: mobile */
.card { padding: 1rem; font-size: 14px; }

@media (width >= 640px)  { .card { padding: 1.5rem; } }
@media (width >= 1024px) { .card { font-size: 16px; } }
@media (width >= 1440px) { .card { padding: 2rem; } }

Dark mode

:root {
  --bg: #fff;
  --fg: #111;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #f5f5f5;
  }
}
body { background: var(--bg); color: var(--fg); }

Reduced motion (a11y)

.fade { transition: opacity 0.4s ease; }

@media (prefers-reduced-motion: reduce) {
  .fade { transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Hover-only enhancements

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #eee; transform: scale(1.02); }
}

Print stylesheet

@media print {
  nav, .ads, .comments { display: none; }
  body { font-size: 12pt; color: #000; background: #fff; }
  a::after { content: " (" attr(href) ")"; }
}

JS 의 matchMedia

const dark = window.matchMedia('(prefers-color-scheme: dark)');
dark.addEventListener('change', (e) => {
  document.documentElement.dataset.theme = e.matches ? 'dark' : 'light';
});

Container Query (2026 표준, MQ 와 의 보완)

.card-host { container-type: inline-size; }

@container (width >= 400px) {
  .card { display: grid; grid-template-columns: 120px 1fr; }
}

매 결정 기준

상황 Approach
Viewport-level layout Media Query
Component-level adaptation Container Query
사용자 preference (dark/motion) prefers-* MQ
JS 의 query check matchMedia
Print styling @media print

기본값: mobile-first + range syntax (width >=).

🔗 Graph

🤖 LLM 활용

언제: responsive breakpoint, dark mode, a11y motion handling 의 generation. 언제 X: component-level adaptation (Container Query 의 사용).

안티패턴

  • Device-targeted MQ: iPhone, iPad 의 device sniff — 매 width-based 의 사용.
  • 너무 many breakpoints: 5개 이상 의 maintenance hell — 매 3-4개 의 기본.
  • prefers-reduced-motion 의 무시: a11y 위반.
  • max-width desktop-first: cascade 의 복잡 — 매 mobile-first.

🧪 검증 / 중복

  • Verified (MDN Media Queries, CSS Media Queries Level 4/5).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — MQ patterns + range syntax + container queries