block elements
Start on a new line and usually fill available width.
Learn Block & Inline with practical examples for structure, layout semantics, metadata, embedded content, scripts, accessibility, SEO and live practice.
HTML structure and layout
HTML elements have default display behavior. Some elements naturally start on a new line and stretch across available width. Others flow inside a line of text. That difference affects layout before you write a single line of CSS.
Block and inline are not about importance. They are about how boxes participate in normal document flow. A paragraph is block-level by default. A link inside that paragraph is inline by default.
Modern CSS can change display behavior, but strong developers first understand the browser default. That makes layout bugs much easier to diagnose.
Start on a new line and usually fill available width.
Flow inside text and only take the space they need.
The default layout before flexbox, grid or positioning.
The CSS property that can change how an element participates in layout.
Syntax and structure
Do not choose an element because it appears block or inline. Choose it for meaning, then change display with CSS if needed.
<section class="lesson-section">
<h1>Block elements form page structure.</h1>
<p>
Inline elements such as <a href="#example">links</a>
sit inside text.
</p>
</section>
<style>
.lesson-section { display: block; }
a { display: inline; }
</style>
<span class="page-title">Main page heading</span> <br><br> <div>Read <div>more</div> now</div>
Rules that matter
Layout-focused HTML is strongest when meaning, grouping, metadata and behavior hooks all have a clear reason to exist.
Before flex and grid, understand what the browser already does.
Spacing belongs in CSS, not repeated line breaks.
A heading needs heading semantics, even if CSS later changes display.
Links, emphasis and short labels usually belong inside text flow.
display: block, inline-block, flex and grid are styling decisions.
The box model becomes much clearer when you look at computed display values.
Production thinking
This matters because layout is not magic. Block and inline behavior is the foundation underneath spacing, wrapping, alignment and responsive design.
Screen readers care about element meaning, not only visual line breaks. A span that looks like a heading is still not a heading.
Many layout bugs start with the wrong mental model of default display. Debug normal flow before adding more CSS.
Semantic structure still matters when CSS changes display. Search engines do not treat a styled span as a real h1.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.