Skip to Main Content or Page Contents
List of HTML5 Block Level Elements
List of HTML5 Inline Level Elements
Block-level & Inline-level elements - Difference
Block-level & inline-elements are displayed differently by your web browser. Basically Block-element elements are displayed vertically, i.e. the first Block-element element is displayed above the second one.
Inline-elements are displayed one after the other on the same line, if the line is wide enough else they will word wrap
<address>, <article>,<aside>,<blockquote>, <div>, <canvas>, <dd>, <div>, <dl>, <dt>, <fieldset>, <figcaption>, <figure>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <hr>, <li>, <main>, <nav>, <noscript>, <ol>, <output>, <p>, <pre>, <section>, <table>, <tfoot>, <ul>, <video>
<a>, <abbr>, <acronym>, <b>, <bdo>, <big>, <br>, <button>, <cite>, <code>, <dfn>, <em>, <i>, <img>, <input>, <kbd>, <label>, <map>, <object>, <q>, <samp>, <script>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <textarea>, <time>, <tt>, <var>
HTML
<p>Block-element 1.</p>
<p>Block-element 2.</p>
<p>Block-element 3.</p>
Result
Block-element 1.
Block-element 2.
Block-element 3.
Example ExplanationThe 3 <p> block-level elements are displayed stacked vertically
These display defaults can be changed by CSS using the display property, to any of the following inline, inline-block, block
or to hardly used properties of
none, list-item, run-in, compact, marker, table, inline-table, table-row, table-row-group, table-header-group, table-footer-group, table-column-group, table-column, table-cell, table-caption, inherit.
E.g.
h2 { display: inline-block}
This allows the h2 element to be placed next to other inline-elements but still retain some of the block properties such as top & bottom margins
All
in this HTML CSS tutorial have been changed to inline-blocks by CSS ans there fore appear on 1 line in your window is wide enough
Can have other inline-elements nested within them but can not contain Block-elements
Note Inline-level Elements are usually, but not always are nested within a Block-level element such as a <p> or <div> element
HTML
Result
Inline-element 1. Inline-element 3.Example Explanation
This site is hosted on Hostgator