---
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).