---
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 `<div>` 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 `<div class="vl"></div>`. [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).
