Files
2nd/10_Wiki/Topic_Programming/Frontend/Relative-Positioning.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

5.0 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-relative-positioning Relative Positioning 10_Wiki/Topics verified self
position-relative
CSS-relative-positioning
none A 0.9 applied
css
positioning
layout
frontend
2026-05-10 pending
language framework
css browser-css

Relative Positioning

매 한 줄

"매 element 의 normal flow 의 위치 의 유지하면서 visual offset 의 적용 + absolute children 의 anchor 의 establish.". CSS2.1 의 정의된 position: relative 의 매 modern layout 의 foundational primitive — flow 의 영향 없이 painting 의 shift, top/right/bottom/left 의 offset, containing block 의 establish 로 의 absolute descendant 의 reference frame 의 제공.

매 핵심

매 정의

  • position: relative 의 element 의 normal flow 에서 의 그대로 의 space 의 reserve 함.
  • top/left/right/bottom 의 visual paint 의 offset — 매 layout 의 surrounding 의 영향 없음.
  • z-index 의 적용 가능 (stacking context 의 establishes when paired with z-index 외 의 0).
  • Absolute descendants 의 의 nearest positioned ancestor 가 됨.

매 vs. 다른 positioning

  • static (default): offset 의 무시, stacking context 없음.
  • absolute: flow 에서 의 제거, nearest positioned ancestor 의 anchor.
  • fixed: viewport 의 anchor.
  • sticky: relative + scroll-bound 의 hybrid.

매 응용

  1. Absolute child 의 containment frame 의 establish.
  2. Decorative offset (icon nudge, badge placement) 의 layout 의 disturbing 없이.
  3. z-index 의 stacking context 의 create.
  4. Tooltip / dropdown 의 anchor.

💻 패턴

Absolute child 의 containment

.card {
  position: relative; /* anchor for .badge */
  padding: 1rem;
}
.card .badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

Visual nudge 의 offset (layout 의 영향 없음)

.icon-up {
  position: relative;
  top: -2px; /* shifts paint, surrounding text unaffected */
}

Stacking context 의 establish

.modal-backdrop {
  position: relative;
  z-index: 0; /* creates new stacking context */
  isolation: isolate; /* modern alternative — no offset needed */
}

Tooltip anchor

.tooltip-host {
  position: relative;
  display: inline-block;
}
.tooltip-host .tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

Sticky alternative 의 비교

/* relative: scrolls with content */
.note { position: relative; top: 10px; }

/* sticky: relative until threshold, then fixed */
.toc { position: sticky; top: 0; }

React + CSS-in-JS (styled-components)

const Card = styled.div`
  position: relative;
  border: 1px solid #ddd;
`;
const Pin = styled.span`
  position: absolute;
  top: -8px;
  left: -8px;
`;

export const PinnedCard = ({ children }: { children: ReactNode }) => (
  <Card>
    <Pin>📌</Pin>
    {children}
  </Card>
);

Tailwind CSS 의 utility 형

<div className="relative p-4 border">
  <span className="absolute top-2 right-2 text-xs">NEW</span>
  Content
</div>

매 결정 기준

상황 Approach
Absolute child 의 의 anchor 의 필요 position: relative (offset 없이도 OK)
Element 의 visual nudge position: relative; top: Npx
Stacking context 의 isolation isolation: isolate (modern) > position: relative; z-index: 0
Layout 의 영향 없는 shift transform: translate() (compositor-only, faster)
Element 의 flow 에서 의 제거 position: absolute (not relative)

기본값: containment frame 의 의 position: relative. Visual offset 의 의 transform.

🔗 Graph

🤖 LLM 활용

언제: absolute children 의 의 frame, decorative offset, stacking context 의 isolation. 언제 X: layout-disturbing offset 이 의도된 경우 (margin 의 사용), fixed positioning 의 desired 한 경우, GPU-accelerated motion (transform 의 사용).

안티패턴

  • 남용 의 position: relative; top:: layout 의 visual gap 의 introduce — transform: translate() 의 사용 (compositor-only, no reflow).
  • Z-index 의 무관한 use: stacking context 의 explicit establish 없이 의 z-index: 9999isolation: isolate 의 사용.
  • Relative 의 absolute 의 confusing: relative 의 normal flow 의 유지함 — element 의 remove 의 의도된 경우 의 absolute 의 사용.
  • Negative offset 의 layout breakage: top: -50px 의 surrounding content 의 overlap — transform 또는 margin-top: -50px (flow 의 영향) 의 trade-off 의 명확.

🧪 검증 / 중복

  • Verified (CSS 2.1 spec, MDN, CSS Working Group draft 2026).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — full content with patterns + 2026 modern alternatives