--- id: html-block-and-inline title: "HTML Block and Inline" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["block-level elements", "inline elements", "display block", "display inline", "div vs span"] 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: ["html", "web", "frontend", "w3schools", "layout"] raw_sources: ["https://www.w3schools.com/html/html_blocks.asp"] applied_in: [] github_commit: "" --- # [[HTML Block and Inline]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Every HTML element has a default display value β€” block-level elements start on a new line and take the full width, while inline elements flow within a line and take only the width they need. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Default display value** β€” every HTML element has a default display value depending on what type of element it is. The two most common display values are block and inline. [S1] - **Block-level element** β€” always starts on a new line; browsers automatically add some space (a margin) before and after it; takes up the full width available. [S1] - **Inline element** β€” does not start on a new line; only takes up as much width as necessary. [S1] - **`
`** β€” a block-level element used as a container for other HTML elements. [S1] - **``** β€” an inline container used to mark up a part of a text, or a part of a document. [S1] - **Nesting rule** β€” an inline element cannot contain a block-level element. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Block container pattern** β€” use `
` to group block-level sections that each occupy their own horizontal band. [S1] - **Inline highlight pattern** β€” use `` to style a fragment of text inside a larger block without breaking the flow of the line. [S1] - **Containment constraint** β€” block elements may contain inline elements, but inline elements may not contain block elements. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **Block-level Elements.** A block-level element always starts on a new line, and the browsers automatically add some space (a margin) before and after the element. A block-level element always takes up the full width available (stretches out to the left and right as far as it can). Two commonly used block elements are `

` and `

`. [S1] ```html

Hello World

Hello World
``` Here are the block-level elements in HTML: [S1] `
`, `
`, `