--- id: css-overflow-x-and-y title: "CSS Overflow X and Y" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["overflow-x", "overflow-y", "CSS overflow xy", "horizontal overflow", "vertical overflow", "directional overflow"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.87 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "overflow", "layout"] raw_sources: ["https://www.w3schools.com/css/css_overflow_xy.asp"] applied_in: [] github_commit: "" --- # [[CSS Overflow X and Y]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) `overflow-x` and `overflow-y` control overflow independently per axis β€” the horizontal (left/right) edges and the vertical (top/bottom) edges β€” giving finer control than the single `overflow` shorthand. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **overflow-x** β€” specifies what to do with the left/right edges of the content. [S1] - **overflow-y** β€” specifies what to do with the top/bottom edges of the content. [S1] - **independent control** β€” the two properties allow managing layout more precisely than using the general `overflow` property alone. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Asymmetric scrolling** β€” combine different values per axis (e.g. `overflow-x: hidden; overflow-y: scroll;`) when horizontal and vertical content should behave differently. [S1] - **Single-axis scroll regions** β€” wide tables and code blocks use `overflow-x: auto`; chat feeds use `overflow-y: scroll`. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **Core concepts** [S1] `overflow-x` and `overflow-y` control how content overflows independently in each direction. `overflow-x` specifies what to do with the left/right edges of the content; `overflow-y` specifies what to do with the top/bottom edges of the content. These allow developers to manage layout more precisely than using the general `overflow` property alone. **Example 1 β€” hide horizontal, add vertical scrollbar** [S1] ```css div { overflow-x: hidden; overflow-y: scroll; } ``` **Example 2 β€” horizontal scrollbar only** [S1] ```css div { overflow-x: scroll; overflow-y: hidden; } ``` **Common use cases** [S1] 1. **Horizontal scrolling table** β€” use `overflow-x: auto` for wide data tables. 2. **Chat windows** β€” use `overflow-y: scroll` for vertical message feeds. 3. **Code blocks** β€” use `overflow-x: auto` to accommodate lengthy code lines. These directional properties provide granular control when different scroll behavior is needed for horizontal versus vertical content overflow. ## πŸ› οΈ 적용 사둀 (Applied in summary) The page applies the properties to a `div`: hiding horizontal overflow while scrolling vertically, and scrolling horizontally while hiding vertical overflow. Listed real-world uses are horizontally scrolling tables, vertically scrolling chat windows, and horizontally scrolling code blocks. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Vertical scroll, no horizontal overflow (language: CSS): ```css div { overflow-x: hidden; overflow-y: scroll; } ``` Horizontal scroll, no vertical overflow (language: CSS): ```css div { overflow-x: scroll; overflow-y: hidden; } ``` ## βš–οΈ 비ꡐ 및 선택 κΈ°μ€€ (Comparison & decision criteria) - **overflow (shorthand)** β€” applies the same behavior to both axes. [S1] - **overflow-x / overflow-y** β€” set behavior per axis independently; choose these when horizontal and vertical content should scroll or clip differently (e.g. wide tables, chat feeds, code blocks). [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.87 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Overflow]], [[CSS Position Fixed and Absolute]], [[CSS Float]] - **μ°Έμ‘° λ§₯락:** Referenced when a container needs different overflow behavior on the horizontal versus the vertical axis. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Overflow X and Y β€” https://www.w3schools.com/css/css_overflow_xy.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Overflow X and Y" page (Astra wiki-curation, P-Reinforce v3.1 format).