Small information nuggets and recipies about HTML
✂️ HTML
(alphabetical order)
Templates
Page structure
<header>header</header>
<nav>nav</nav>
<main>
<section>section</section>
<article>article</article>
<aside>aside</aside>
</main>
<footer>footer</footer>
Other idioms
-
Idioms of semantic HTML
Collection of templates and snippets of semantic HTML that can be used as boilerplate while working on markupArticle details
Article list
Bread crumb navigation
Company info
Conversations
Download link
Figure + WAI-ARIA
Footnotes: annotations
Footnotes: side notes
Form
Glossary of terms
Holy Grail Layout
Metadata
Quotation
Subheadings, subtitles, alternative titles and taglines
Tag clouds
Video
Elements
abbreviation
<abbr title="title">abbreviation</abbr>
➔ abbreviation
anchor / link
<a href="">hyperlink</a>
blockquote
<q>
: The Inline Quotation element - HTML: HyperText Markup Language<blockquote>
: The Block Quotation element - HTML: HyperText Markup Language<cite>
: The Citation element - HTML: HyperText Markup Language
(useful for for screen readers)
… inline
Inline <q>simple quote</q>.
Inline <q cite="http://example.com">quote with citation</q>.
➔ Inline simple quote
.
➔ Inline quote with citation
.
… simple
<blockquote>
<p>Simple quote.</p>
</blockquote>
Simple quote.
… with citation
<blockquote>
<p>Quote with citation.</p>
<footer>— <cite class="author">Author</cite> (in <cite class="title">Source</cite>)</footer>
</blockquote>
Quote with citation.
citation
<cite>person or title</cite>
➔ person or title
code
<code>computer code</code>
➔ computer code
definition
<dfn title="explanation">term</dfn>
➔ term
delete
<del>deleted text</del>
➔ deleted text
details
<details>
<summary>Collapsed title</summary>
<p>Content</p>
</details>
Collapsed title
Content
emphasis
<em>emphatic text</em>
➔ emphatic text
figure
The
img
tag is used to embed the image in an HTML document whereas thefigure
tag is used to semantically organize the content of an image in the HTML document.
<figure>
<img src="http://placehold.it/100x100.png" alt="Image alternate text">
<figcaption>Image caption</figcaption>
</figure>
footnote
text<sup>1</sup>
<small><sup>1</sup> footnote</small>
➔ text1
➔ 1 footnote
heading / titles
h1
–h6
elements must not be used to markup subheadings, subtitles, alternative titles and taglines unless intended to be the heading for a new section or subsection.— How to mark up subheadings, subtitles, alternative titles and taglines | HTML5 Doctor
<header>
<h2>Title</h2>
<p>Tagline or subtitle</p>
</header>
<p>Content</p>
Tagline or subtitle
Content
image
<img src="http://placehold.it/100x100.png" alt="Example alternate text">
insert
<ins>inserted text</ins>
➔ inserted text
keyboard
<kbd>user keyboard input</kbd>
➔ user keyboard input
list
… ordered
<ol>
<li>item</li>
<li>item</li>
<li>item</li>
</ol>
- item
- item
- item
… unordered
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>
- item
- item
- item
main
There must not be more than one
<main>
element in a document.
<main>content unique to the document</main>
mark / highlight
<mark>marked/highlighted text</mark>
➔ marked/highlighted text
sample output
<samp>sample output</samp>
➔ sample output
small print
<small>copyright or side-comments</small>
➔ copyright or side-comments
strong
<strong>strong importance</strong>
➔ strong importance
subscript
<sub>subscript</sub>
➔ subscript
superscript
<sup>superscript</sup>
➔ superscript
table
<table>
<tr>
<th>header cell</th>
<th>header cell</th>
</tr>
<tr>
<td>value cell</td>
<td>value cell</td>
</tr>
</table>
header cell | header cell |
---|---|
value cell | value cell |
time
Dinner at <time>20:00</time> on <time datetime="2020-12-31">New Year’s eve</time>
➔ Dinner at on
variable
<var>code or math variable</var>
➔ code or math variable