Block-level elements are elements that take up the full width of their parent container.
What it does: <h1> through
<h6> mark six levels of document hierarchy — from
the page's primary topic down to minor subsections.
When to use it in real projects:
<h1> for the
hero headline; <h2>/<h3> for
feature sections and sub-headings. Never skip levels — crawlers and
screen readers depend on the hierarchy.
<h1> (or <h2> inside a list),
sub-topics in <h3>. Keep the outline logical so
auto-generated tables of contents work correctly.
<h2> or
<h3> — use them even if you reset their visual
size with CSS; the semantic meaning matters for accessibility.
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
What it does: <p> wraps a discrete
block of text, automatically adding vertical margin above and below it
— the browser's way of visually separating thoughts.
When to use it in real projects:
<p> tags. If your text is prose, it belongs here
— not in a <div>.
<p> tags
automatically. Style them globally in your CSS rather than applying
inline styles per paragraph.
<p> (or
<small> inside one), giving assistive
technologies the right context.
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio, ratione.
</p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio, ratione.
What it does: <pre> renders text
in a monospace font exactly as written in the source — every space,
tab, and newline is preserved, with no collapsing.
When to use it in real projects:
<pre><code> (not just
<code> alone) so indentation and line breaks
render faithfully — syntax highlighters like Prism.js also expect
this structure.
<pre> ensures the
columnar formatting isn't mangled by the browser's whitespace rules.
<pre> to
render correctly.
<pre>
Lorem ipsum dolor sit amet consectetur,
adipisicing elit. Dolore, itaque!
</pre>
Lorem ipsum dolor sit amet consectetur,
adipisicing elit. Dolore, itaque!
What it does: <ul> renders a
bulleted list where sequence doesn't matter. The
type attribute (or CSS list-style-type)
controls the bullet marker.
When to use it in real projects:
<ul> underneath — reset bullets with
list-style: none and lay items out with flexbox.
Simple markers defined directly in the HTML tag. Modern development prefers CSS for this.
<h3>Soft Drinks</h3>
<ul type="disc">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
<h3>Soft Drinks</h3>
<ul type="circle">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
<h3>Soft Drinks</h3>
<ul type="square">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
<h3>Soft Drinks</h3>
<ul type="none">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
Using list-style-type for more flexibility and consistent
styling.
<ul style="list-style-type: disc;">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
<ul style="list-style-type: circle;">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
<ul style="list-style-type: square;">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
<ul style="list-style-type: none;">
<li>Coke</li>
<li>Pepsi</li>
<li>Sarsi</li>
</ul>
What it does: <ol> renders a
sequentially numbered list where order is semantically significant.
The type attribute switches the counter style (1, A, a,
I, i).
When to use it in real projects:
<ol> territory.
<div> stack.
The type attribute is the original way to change list
markers, still supported but limited to five basic styles.
<ol type="1">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol type="A">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol type="i">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol type="I">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
The list-style-type property is the modern standard,
offering more options and better integration with design systems.
<ol style="list-style-type: decimal;">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol style="list-style-type: lower-alpha;">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol style="list-style-type: upper-alpha;">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol style="list-style-type: lower-roman;">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol style="list-style-type: upper-roman;">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
<ol style="list-style-type: none;">
<li>Macha</li>
<li>Taro</li>
<li>Chocolate</li>
</ol>
What it does: <dl> pairs terms
(<dt>) with their definitions or descriptions
(<dd>), providing a semantic key-value structure
that plain paragraphs can't express.
When to use it in real projects:
<dl> use cases — term on the left, explanation
indented below.
<dt>/<dd>
pairs. Screen readers announce them as definition groups, improving
accessibility.
<dt>,
answer in <dd> — semantically cleaner than a
heading-paragraph pattern and easier to style consistently across a
CMS.
<dl>
<dt>HTML</dt>
<dd>This is the backbone of the website</dd>
<dt>CSS</dt>
<dd>This is the appearance of the website</dd>
<dt>Javascript</dt>
<dd>This is the behavior of the website</dd>
</dl>
What it does: <table> organizes
data into a two-dimensional grid of rows and columns, creating a
semantic link between headers (<th>) and data cells
(<td>).
When to use it in real projects:
<table border="1" style="width: 100%; border-collapse: collapse;">
<thead>
<tr style="background-color: #e67e22; color: white;">
<th colspan="3">Meralco Bill Breakdown (Pass-Through Charges)</th>
</tr>
<tr style="background-color: #ecf0f1; text-align: left;">
<th style="padding: 8px;">Charge Category</th>
<th style="padding: 8px;">Specific Charge</th>
<th style="padding: 8px;">Amount (PhP)</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 8px;">Generation</td>
<td style="padding: 8px;">Generation Charge</td>
<td style="padding: 8px;">730.60</td>
</tr>
<tr>
<td rowspan="3" style="vertical-align: middle; padding: 8px;">Subsidies & Allowances</td>
<td style="padding: 8px;">Lifeline Rate Subsidy</td>
<td style="padding: 8px;">7.34</td>
</tr>
<tr>
<td style="padding: 8px;">Senior Citizen Subsidy</td>
<td style="padding: 8px;">0.01</td>
</tr>
<tr>
<td style="padding: 8px;">FIT-All (Renewable)</td>
<td style="padding: 8px;">8.36</td>
</tr>
</tbody>
<tfoot>
<tr style="background-color: #f9f9f9; font-style: italic;">
<td colspan="3" style="padding: 8px;">* Computations based on an assumed 100 kWh monthly consumption. These are mandated pass-through charges remitted to other entities.</td>
</tr>
</tfoot>
</table>
| Meralco Bill Breakdown (Pass-Through Charges) | ||
|---|---|---|
| Charge Category | Specific Charge | Amount (PhP) |
| Generation | Generation Charge | 730.60 |
| Subsidies & Allowances | Lifeline Rate Subsidy | 7.34 |
| Senior Citizen Subsidy | 0.01 | |
| FIT-All (Renewable) | 8.36 | |
| * Computations based on an assumed 100 kWh monthly consumption. These are mandated pass-through charges remitted to other entities. | ||
What it does: <div> is a generic
block container with no implicit meaning — it groups elements purely
for layout and styling purposes, taking the full width of its parent
by default.
When to use it in real projects:
<div> is the right choice when no semantic
element fits (prefer <section>,
<article>, or <main> when they
do).
<div> (or a Fragment), scoping its
styles and event handlers.
<div> with explicit
dimensions, making them independently scrollable, positionable, and
styleable.
<div style="display: flex; gap: 20px; flex-wrap: wrap;">
<!-- Example 1: Using Picsum -->
<div style=" border: 1px solid #ddd; border-radius: 8px; overflow: hidden;">
<img src="https://picsum.photos/300/160?random=1" alt="Picsum example" style="width: 100%; height: auto; display: block;">
<div style="padding: 16px;">
<h3 style="margin: 0 0 8px 0; color: #333;">Picsum Photo</h3>
<p style="margin: 0; color: #666; font-size: 14px; line-height: 1.5;">Random images from Lorem Picsum service.</p>
</div>
</div>
<!-- Example 2: Using Pravatar -->
<div style=" border: 1px solid #ddd; border-radius: 8px; overflow: hidden;">
<img src="https://i.pravatar.cc/300" alt="Pravatar example" style="width: 100%; height: auto; display: block;">
<div style="padding: 16px;">
<h3 style="margin: 0 0 8px 0; color: #333;">Pravatar Avatar</h3>
<p style="margin: 0; color: #666; font-size: 14px; line-height: 1.5;">Placeholder avatars from Pravatar service.</p>
</div>
</div>
<!-- Example 3: Using LoremFlickr -->
<div style=" border: 1px solid #ddd; border-radius: 8px; overflow: hidden;">
<img src="https://loremflickr.com/300/160/people" alt="LoremFlickr example" style="width: 100%; height: auto; display: block;">
<div style="padding: 16px;">
<h3 style="margin: 0 0 8px 0; color: #333;">LoremFlickr People</h3>
<p style="margin: 0; color: #666; font-size: 14px; line-height: 1.5;">Random people images from LoremFlickr service.</p>
</div>
</div>
</div>