--- id: wiki-2026-0508-프론트엔드-기초-구조-이해 title: 프론트엔드 기초 구조 이해 category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Frontend Fundamentals, FE Foundation, 프론트엔드 기초] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [frontend, fundamentals, html, css, javascript, dom] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: TypeScript framework: Browser Platform --- # 프론트엔드 기초 구조 이해 ## 매 한 줄 > **"매 browser 의 매 4-stage pipeline + 매 3-language stack + 매 1 event loop"**. 매 HTML(structure) → 매 CSS(presentation) → 매 JS(behavior) 의 매 stack 위 에서 매 browser 의 매 Parse → Style → Layout → Paint → Composite pipeline 이 매 60Hz/120Hz frame budget 안 에 매 실행 — 매 이 underlying model 의 매 이해가 매 모든 매 framework 의 매 root. ## 매 핵심 ### 매 3-Language Stack - **HTML**: 매 semantic structure — 매 accessibility tree · 매 SEO · 매 progressive enhancement 의 매 base. - **CSS**: 매 declarative styling — 매 cascade · 매 specificity · 매 box model · 매 flex/grid · 매 container query. - **JS**: 매 imperative behavior — 매 event-driven · 매 single-thread · 매 async runtime. ### 매 Browser Rendering Pipeline 1. **Parse** — HTML → DOM tree, CSS → CSSOM tree. 2. **Style** — DOM + CSSOM → render tree (매 computed styles). 3. **Layout (reflow)** — 매 geometry 계산 (position, size). 4. **Paint** — 매 pixel 의 매 fill (color, shadow, gradient). 5. **Composite** — 매 GPU 의 매 layer 합성 (transform, opacity). ### 매 Event Loop & Concurrency - 매 single-threaded JS — 매 macrotask queue + 매 microtask queue. - 매 microtask (Promise, queueMicrotask) — 매 current task 후 즉시 drain. - 매 macrotask (setTimeout, I/O) — 매 다음 tick. - 매 rAF — 매 paint 직전 매 호출. ### 매 응용 1. 매 모든 framework 의 매 fundament — React/Vue/Svelte/Solid 의 매 underlying. 2. 매 performance debugging. 3. 매 accessibility & SEO. ## 💻 패턴 ### Pattern 1: 매 Semantic HTML ```html
``` ### Pattern 2: 매 CSS Cascade & Specificity ```css /* 매 specificity: inline > id > class > element */ /* 매 0,0,0,1 */ p { color: black; } /* 매 0,0,1,0 */ .text { color: blue; } /* 매 0,1,0,0 */ #intro { color: red; } /* 매 1,0,0,0 */ /* style="color: green" */ /* !important — 매 last resort */ ``` ### Pattern 3: 매 Modern Layout (Grid + Flex) ```css .layout { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; min-height: 100dvh; } .toolbar { display: flex; gap: .5rem; align-items: center; } /* 매 container query — 매 component-level responsive */ @container (min-width: 600px) { .card { display: grid; grid-template-columns: 1fr 2fr; } } ``` ### Pattern 4: 매 DOM API ```typescript // 매 query const btn = document.querySelector('#submit'); // 매 event delegation — 매 single listener for many children document.querySelector('.list')!.addEventListener('click', (e) => { const target = (e.target as HTMLElement).closest('[data-id]'); if (target) handleClick(target.dataset.id!); }); ``` ### Pattern 5: 매 Async / Event Loop ```typescript async function fetchUser(id: string) { const res = await fetch(`/api/user/${id}`); if (!res.ok) throw new Error(`HTTP ${res.status}`); return res.json(); } // 매 parallel const [user, posts] = await Promise.all([ fetchUser(id), fetch(`/api/posts?user=${id}`).then(r => r.json()), ]); ``` ### Pattern 6: 매 Web API 활용 ```typescript // IntersectionObserver — 매 scroll-based lazy load const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) { (e.target as HTMLImageElement).src = (e.target as HTMLImageElement).dataset.src!; io.unobserve(e.target); } } }); document.querySelectorAll('img[data-src]').forEach(img => io.observe(img)); ``` ### Pattern 7: 매 Accessibility 기본 ```html ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | 매 component layout | Flex (1D) / Grid (2D) | | 매 reactive style | CSS custom property + JS update | | 매 list rendering | Event delegation, IntersectionObserver | | 매 animation | transform + opacity (composite-only) | | 매 form | Native form + constraint validation API | **기본값**: 매 semantic HTML → 매 modern CSS (Grid/Flex/container query) → 매 minimal JS. ## 🔗 Graph - 부모: [[웹 프론트엔드 아키텍처 설계]] - 변형: [[프론트엔드 기초 구조 이해 핵심 목적]] · [[프레임워크별_실전_패턴]] - 응용: [[프론트엔드 렌더링 최적화(Rendering Optimization)]] · [[웹 접근성 및 성능 최적화]] - Adjacent: [[서버 사이드 렌더링(SSR)과 하이드레이션(Hydration)]] · [[유지보수 가능한 CSS 아키텍처(CSS Modules & Tailwind)]] ## 🤖 LLM 활용 **언제**: 매 fundamentals teaching, 매 framework-agnostic debugging, 매 accessibility audit, 매 performance root-cause. **언제 X**: 매 framework-specific pattern (React hook, Vue composable) — 매 그 framework 문서 참조. ## ❌ 안티패턴 - **매 div soup**: 매 semantic 무시 — 매 a11y / SEO 손실. - **매 !important spam**: 매 specificity war — 매 maintainability 붕괴. - **매 inline event handler 의 다수**: 매 onclick="..." 의 spread — 매 CSP / 매 separation 위반. - **매 layout thrashing**: 매 read-write-read 의 매 mix in 매 loop. - **매 sync XHR**: 매 main thread block — 매 fetch async 사용. ## 🧪 검증 / 중복 - Verified (MDN, WHATWG HTML spec, W3C CSS spec, web.dev 2026). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — frontend fundamentals canonical 정리 |