--- id: css-text-alignment title: "CSS Text Alignment" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["text-align", "text alignment", "text-align-last", "vertical-align", "text direction"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.88 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "text", "alignment"] raw_sources: ["https://www.w3schools.com/css/css_text_align.asp"] applied_in: [] github_commit: "" --- # [[CSS Text Alignment]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) CSS controls horizontal text alignment with `text-align` and `text-align-last`, vertical positioning with `vertical-align`, and text directionality with `direction` and `unicode-bidi`. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Five related properties** β€” `text-align`, `text-align-last`, `vertical-align`, `direction`, and `unicode-bidi`. [S1] - **`text-align` values** β€” `left` (aligns text to the left), `right` (aligns text to the right), `center` (centers the text), and `justify` (stretches the lines so that each line has equal width). [S1] - **`text-align-last`** β€” specifies alignment for the final line; values: `auto`, `left`, `right`, `center`, `justify`, `start`, and `end`. [S1] - **`vertical-align`** β€” values include `baseline`, length/%, `sub`, `super`, `top`, `text-top`, `middle`, `bottom`, and `text-bottom`. [S1] - **Text direction** β€” `direction` with `unicode-bidi` controls right-to-left text. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Heading alignment pattern** β€” assign different `text-align` values across `h1`/`h2`/`h3` for varied alignment. [S1] - **Justify-block pattern** β€” `text-align: justify;` stretches each line to equal width. [S1] - **Inline-image vertical alignment pattern** β€” apply `vertical-align` per image class to position images relative to text. [S1] - **RTL pattern** β€” combine `direction: rtl;` with `unicode-bidi: bidi-override;` for right-to-left text. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) The page introduces five CSS properties for text alignment and direction: `text-align`, `text-align-last`, `vertical-align`, `direction`, and `unicode-bidi`. [S1] **Text Alignment** β€” the `text-align` property accepts: "left - Aligns the text to the left," "right - Aligns the text to the right," "center - Centers the text," and "justify - Stretches the lines so that each line has equal width." [S1] Example 1: [S1] ```css h1 { text-align: center; } h2 { text-align: left; } h3 { text-align: right; } ``` Example 2: [S1] ```css div { text-align: justify; } ``` **Text Align Last** β€” the `text-align-last` property specifies alignment for the final line, with values: `auto`, `left`, `right`, `center`, `justify`, `start`, and `end`. [S1] ```css p.a { text-align-last: right; } p.b { text-align-last: center; } p.c { text-align-last: justify; } ``` **Vertical Alignment** β€” the `vertical-align` property includes values like `baseline`, length/%, `sub`, `super`, `top`, `text-top`, `middle`, `bottom`, and `text-bottom`. [S1] ```css img.a { vertical-align: baseline; } img.b { vertical-align: text-top; } img.c { vertical-align: text-bottom; } img.d { vertical-align: sub; } img.e { vertical-align: super; } ``` **Text Direction** β€” [S1] ```css p { direction: rtl; unicode-bidi: bidi-override; } ``` A summary table on the page lists all five properties with their descriptions. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own examples are the applied cases: per-heading horizontal alignment, justified blocks, last-line alignment on paragraphs, per-image vertical alignment, and an RTL paragraph. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Horizontal alignment pattern (language: CSS): ```css selector { text-align: left | right | center | justify; } ``` Concrete example: ```css h1 { text-align: center; } ``` ## βš–οΈ 비ꡐ 및 선택 κΈ°μ€€ (Comparison & decision criteria) - **`text-align` vs `text-align-last`** β€” `text-align` aligns all lines of a block, while `text-align-last` controls only the alignment of the final line. [S1] - **`text-align` vs `vertical-align`** β€” `text-align` controls horizontal alignment of text; `vertical-align` controls the vertical positioning of inline content (e.g., images) relative to the line. [S1] - **`justify` value choice** β€” choose `justify` when each line should stretch to equal width; choose `left`/`right`/`center` for simple alignment without stretching. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) No contradictions found in the source. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯) - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Text Color]], [[CSS Text Decoration]], [[CSS Text Spacing]] - **μ°Έμ‘° λ§₯락:** Referenced when positioning text horizontally/vertically or supporting right-to-left languages. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Text Alignment β€” https://www.w3schools.com/css/css_text_align.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Text Alignment" page (Astra wiki-curation, P-Reinforce v3.1 format).