--- id: howto-css-vertical-line title: "How To - Vertical Line" category: "Web_Recipes" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["border-left divider CSS"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.8 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["howto", "css", "w3schools", "layout", "border"] raw_sources: ["https://www.w3schools.com/howto/howto_css_vertical_line.asp"] applied_in: [] github_commit: "" --- # [[HOWTO CSS Vertical Line]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) A "vertical line" isn't a special CSS shape primitive at all β€” it's an empty `
` with `height` set and ONLY a `border-left` declared (no other sides), and centering it uses a variant of the absolute-positioning trick already seen elsewhere: `left: 50%; margin-left: -3px;` (half of the 6px border width, negated) achieves the same "shift back by half my own size" effect that `transform: translateX(-50%)` would, just computed manually instead of automatically. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`border-left` only, on an empty div** β€” `.vl { border-left: 6px solid green; height: 500px; }` β€” no width, no content; the border alone forms the visible line. [S1] - **Manual half-width offset for centering** β€” `left: 50%; margin-left: -3px;` (half of the 6px border, negated) recenters the line, since `left: 50%` alone would place its LEFT EDGE at the midpoint rather than centering the line itself. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic vertical line: `.vl { border-left: 6px solid green; height: 500px; }` applied to an empty `
`. [S1] - Centered version: `.vl { border-left: 6px solid green; height: 500px; position: absolute; left: 50%; margin-left: -3px; top: 0; }`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **transform λŒ€μ‹  μˆ˜λ™ margin κ³„μ‚°μœΌλ‘œ 쀑앙 μ •λ ¬**: `[[HOWTO CSS Center Vertical]]`의 `transform: translate(-50%, -50%)`κ°€ μžλ™μœΌλ‘œ 자기 μžμ‹ μ˜ 절반만큼 λ˜λŒλ¦¬λŠ” 것과 달리, 이 λ ˆμ‹œν”ΌλŠ” ν…Œλ‘λ¦¬ λ‘κ»˜(6px)의 절반인 -3pxλ₯Ό margin-left둜 μˆ˜λ™ 계산해 λ™μΌν•œ 효과λ₯Ό λ‚Έλ‹€λŠ” 점이 확인됨 β€” 같은 λͺ©μ μ„ μžλ™ vs μˆ˜λ™ λ°©μ‹μœΌλ‘œ 각각 κ΅¬ν˜„. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” μ΄ˆλ‘μƒ‰ 6px μ„Έλ‘œμ„ μ„ λ§Œλ“€κ³  ν™”λ©΄ 쀑앙에 λ°°μΉ˜ν•˜λŠ” μ΅œμ†Œ μ˜ˆμ œκ°€ μ›λ¬Έμ—μ„œ μ œμ‹œλ¨. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) An empty div with only border-left, centered via manual margin offset (CSS): ```css .vl { border-left: 6px solid green; height: 500px; position: absolute; left: 50%; margin-left: -3px; /* half of border-left width, negated */ top: 0; } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference) - **μ‹ λ’° 점수:** 0.80 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[W3Schools HOW TO]] - **κ΄€λ ¨ κ°œλ…:** [[HOWTO CSS Center Vertical]], [[HOWTO CSS Dividers]], [[HOWTO CSS Text Divider]] - **μ°Έμ‘° λ§₯락:** CSS Layout & Positioning μ„Ήμ…˜. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” How To - Vertical Line β€” https://www.w3schools.com/howto/howto_css_vertical_line.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "How To - Vertical Line" recipe (Astra wiki-curation, P-Reinforce v3.1 format).