Block and Inline Elements
Introduction to HTML
Basic HTML Document Structure
Headings
Paragraphs
Line Break and Horizontal Rule
Text Formatting Tags
Comments
Attributes
Links
Open Link in New Tab
Images
Image as Link
Favicon
Lists
Ordered Lists
Description Lists
Nested Lists
Tables
Table Caption and Spanning
Block and Inline Elements
div Element
span Element
Semantic HTML
Layout Elements
Forms
Input Types
Labels
Radio Buttons and Checkboxes
Select and Option
Textarea
Button
Fieldset and Legend
Datalist
Output Element
Form Validation Attributes
Audio
Video
iframe
embed Element
Figure and Figcaption
Details and Summary
Progress and Meter
Time and Data Elements
Canvas
SVG
Responsive Images
Accessibility Basics
SEO-Oriented HTML
Global Attributes
Event Attributes
Image Map
Iframe for Maps or Video
Metadata and Head Elements
HTML Entities, Symbols, and Emojis
Deprecated and Legacy Tags
Block and Inline Elements
20. Block and Inline Elements
HTML elements are commonly explained as block-level or inline based on how they flow in the page. Block elements usually start on a new line, while inline elements flow within surrounding text.
Syntax
<div>Block</div>
<span>Inline</span>
Example
<div>This is a block element.</div>
<span>This is inline.</span>
<span>So is this.</span>
Output
The div appears on its own line, while the span elements appear inline next to each other.
Example
Executing...
❌ Error:
✅ Output:
// Click Run ▶ to execute
🏋️ Test Yourself With Exercises
Take our quiz on Block and Inline Elements to test your knowledge.
Browse Quizzes »