HTML Snippets I Like
2022-01-19
Modern CSS is powerful enough that the complex element layouts of yore are no longer necessary. But there are still a few small patterns I wanted to collect somewhere so I don't have to go hunting for them each time.
Some of these snippets come from the excellent HTML5 Doctor.
The snippets
Boilerplate:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
lang="en"
makes the document language explicit.- the first
<meta>
makes the character encoding explicit. - the second
<meta>
makes the site work on mobile displays. - the
<link>
elements define external resources to load.
<article>
structure:
1 2 3 4 5 6 7 8 |
|
Heading with subtitle:
1 2 3 4 |
|
<blockquote>
with citation:
1 2 3 4 |
|
Small CSS gotchas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|