--- id: css-inline-block title: "CSS Inline-block" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["display inline-block", "inline-block", "inline vs block", "horizontal nav menu", "inline-block menu"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.89 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "display", "layout"] raw_sources: ["https://www.w3schools.com/css/css_inline-block.asp"] applied_in: [] github_commit: "" --- # [[CSS Inline-block]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) `display: inline-block` makes an element flow on the same line as other inline/inline-block elements while still accepting `width`, `height`, `margin-top`, and `margin-bottom` like a block element β€” the bridge between inline and block behavior. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Definition** β€” an element with `display: inline-block` will appear on the same line as other inline or inline-block elements. [S1] - **Block-like sizing on an inline-flow element** β€” in addition to flowing inline, you can set `width`, `height`, `margin-top`, and `margin-bottom` for the element (like block elements). [S1] - **Contrast with `display: inline`** β€” pure inline elements (such as the default `span`) ignore width/height. [S1] - **Contrast with `display: block`** β€” block elements take a full line, breaking the inline flow. [S1] - **Common use case** β€” building a horizontal navigation menu from list items. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Three-way display comparison** β€” placing `inline`, `inline-block`, and `block` spans side by side reveals which respect width/height and which break onto new lines. [S1] - **Horizontal menu pattern** β€” strip list styling and set `display: inline-block` on `li` elements to lay menu items out in a row. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **What is inline-block?** An element with `display: inline-block` will appear on the same line as other inline or inline-block elements. In addition, you can set the `width`, `height`, `margin-top`, and `margin-bottom` properties for the element (like block elements). [S1] **Comparing display values** The following example shows the different behavior of `display: inline`, `display: inline-block` and `display: block`: [S1] ```css span.a { display: inline; /* the default for span */ padding: 5px; border: 2px solid red; } span.b { display: inline-block; width: 100px; height: 35px; padding: 5px; border: 2px solid red; } span.c { display: block; width: 100px; height: 35px; padding: 5px; border: 2px solid red; } ``` **Horizontal navigation menu** A common use of `display: inline-block` is to create a horizontal navigation menu: [S1] ```css .nav { background-color: lightgray; list-style-type: none; padding: 0; margin: 0; } .nav li { display: inline-block; font-size: 18px; padding: 15px; } ``` **Property reference** [S1] | Property | Description | |----------|-------------| | `display` | Specifies the display behavior (the type of rendering box) of an element | ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own applied examples are the inline/inline-block/block span comparison and the horizontal navigation menu built from `inline-block` list items. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Horizontal menu via inline-block (language: CSS): ```css .nav li { display: inline-block; font-size: 18px; padding: 15px; } ``` ## βš–οΈ 비ꡐ 및 선택 κΈ°μ€€ (Comparison & decision criteria) - **`inline` vs `inline-block` vs `block`** β€” `inline` (default for `span`) ignores width/height; `inline-block` stays on the same line yet accepts width, height, and top/bottom margins; `block` takes a full line. Choose `inline-block` when you need elements in a row that still respect explicit dimensions. [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.89 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Display]], [[CSS Float Examples]], [[CSS Horizontal Align]], [[CSS Box Model]] - **μ°Έμ‘° λ§₯락:** Referenced when laying elements out in a row (menus, badges, chips) without losing block-style sizing. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Inline-block β€” https://www.w3schools.com/css/css_inline-block.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Inline-block" page (Astra wiki-curation, P-Reinforce v3.1 format).