This page shows common block and inline HTML tags, their code, and the rendered output. Use it for learning or classroom demos.
Block elements start on a new line and take the full width available. Common block tags:
<h1>–<h6>, <p>, <div>,
<ul>, <ol>, <li>, <section>,
<header>, <footer>, <nav>.
A paragraph — each block starts on a new line and stretches across.
<div> (block)<div> — always on its own line<h3>A heading (block)</h3>
<p>A paragraph — each block starts on a new line and stretches across.</p>
<div>A div (block)</div>
<div>Another div — always on its own line</div>
display (e.g. with Flexbox or
inline-block).
Inline elements sit inside a line of text and do not force a new line. Common inline tags:
<span>, <a>, <strong>, <em>,
<code>, <img>, <br>.
This is a red <span> inside a paragraph. Here is a link <a>, bold <strong>, and italic <em>.
<p>This is a <span style="color: #b91c1c; font-weight: 600">red span</span> inside a paragraph.
Here is a <a href="#">link</a>, <strong>bold</strong>, and <em>italic</em>.</p>
width or height on inline
elements (use inline-block if you need that).
<ul>, <ol>, and <li> are block-level. So
are <section>, <article>, <header>,
<footer>.
A paragraph before the list.
<header>Header (block)</header>
<p>A paragraph before the list.</p>
<ul>
<li>item one (block)</li>
<li>item two (block)</li>
</ul>
<code> for code, <strong> and <em> for
emphasis — all stay in the same line.
Use console.log() to debug. Important: always close your tags.
<p>Use <code>console.log()</code> to debug. <strong>Important:</strong> always <em>close</em> your tags.</p>
CSS display: inline-block makes an element sit inline (like text) but accept width,
height, and vertical alignment. Useful for buttons, cards in a row, etc.
<style>
.inline-box { display: inline-block; width: 120px; height: 72px; background: #fde68a; margin-right: 8px; }
</style>
<div class="inline-box">Box 1</div>
<div class="inline-box">Box 2</div>
<div class="inline-box">Box 3</div>
<div>s (normally block). With
display: inline-block they sit side by side but still respect width and
height.
Click the buttons to change the display of the yellow boxes and see how layout changes.
<div>s — only display changes.
block = stacked; inline-block = side by side with size; inline = in one
line, size ignored.
<h1>–<h6>, <p>,
<div>, <ul>, <ol>, <li>,
<section>, <header>, <footer>, <nav>
— new line, full width.<span>, <a>, <strong>,
<em>, <code>, <img> — flow with text, no new line.display in CSS to change behavior: block, inline,
inline-block, flex.