├── LICENSE
├── README.md
└── html
├── abbreviation.md
├── accordion.md
├── address.md
├── breadcrumb.md
├── buttons.md
├── cli.md
├── contact.md
├── content-changes.md
├── conversations.md
├── cookies-banner.md
├── creative-work.md
├── credit-card.md
├── footnotes.md
├── form-fields.md
├── glosary.md
├── headers.md
├── hidden-elements.md
├── icon-link.md
├── language-switcher.md
├── license.md
├── list.md
├── menu.md
├── metadata.md
├── navigation.md
├── page.md
├── pagination.md
├── passwords-forms.md
├── payment-form.md
├── product-list.md
├── quotes.md
├── range-input.md
├── scalar-values.md
├── search.md
├── tables.md
└── topbar.md
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Oscar Otero
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Semantic HTML
2 |
3 | Collection of semantic and accessible HTML patterns:
4 |
5 | - [Page](html/page.md). Minimum html code required for any webpage
6 | - [Abbreviations and acronyms](html/abbreviation.md)
7 | - [Accordion](html/accordion.md)
8 | - [Address](html/address.md)
9 | - [Breadcrumb](html/breadcrumb.md)
10 | - [Buttons](html/buttons.md)
11 | - [Command line interfaces](html/cli.md)
12 | - [Contact](html/contact.md)
13 | - [Content changes](html/content-changes.md)
14 | - [Conversations](html/conversations.md)
15 | - [Cookies banner](html/cookies-banner.md)
16 | - [Creative work](html/creative-work.md)
17 | - [Credit card form](html/credit-card.md)
18 | - [Footnotes](html/footnotes.md)
19 | - [Form fields](html/form-fields.md)
20 | - [Glosary](html/glosary.md)
21 | - [Headers](html/headers.md)
22 | - [Hidden elements](html/hidden-elements.md)
23 | - [Icon link & buttons](html/icon-link.md)
24 | - [Language switcher](html/language-switcher.md)
25 | - [License](html/license.md)
26 | - [List](html/list.md)
27 | - [Menu](html/menu.md)
28 | - [Metadata](html/metadata.md)
29 | - [Navigation](html/navigation.md)
30 | - [Payment form](html/payment-form.md)
31 | - [Pagination](html/pagination.md)
32 | - [Passwords in forms](html/passwords-forms.md)
33 | - [Product list](html/product-list.md)
34 | - [Quotes](html/quotes.md)
35 | - [Range input](html/range-input.md)
36 | - [Scalar values](html/scalar-values.md)
37 | - [Search](html/search.md)
38 | - [Tables](html/tables.md)
39 | - [Top bar](html/topbar.md)
40 |
41 | ---
42 |
43 | Useful links:
44 |
45 | - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
46 | - https://www.htmhell.dev/adventcalendar/2023/8/
47 |
48 | ---
49 |
50 | Contributions like issues or pull request are highly appreciated.
51 |
--------------------------------------------------------------------------------
/html/abbreviation.md:
--------------------------------------------------------------------------------
1 | # Abbreviation and acronyms
2 |
3 | Provide an expansion of the abbreviation/acronym, neuronym even, in plain text
4 | on first use, use an to mark up the abbreviation, which provides a hint
5 | to user agents on how to announce/display the content
6 |
7 | ```html
8 |
9 | FWIW (For what it's worth) I often get the following confused:
10 | WTF and FTW.
11 |
12 |
13 |
14 | By providing a plain text expansion besides the acronyms, myself and probably
15 | others, are less confused by the jargon. Thus improving usability and a11y (accessibility).
17 |
18 | ```
19 |
20 | ---
21 |
22 | - [Short note: The abbreviation appreciation society](https://developer.paciellogroup.com/blog/2019/03/short-note-the-abbreviation-appreciation-society/)
23 |
--------------------------------------------------------------------------------
/html/accordion.md:
--------------------------------------------------------------------------------
1 | # Accordion
2 |
3 | ## Simple accordion
4 |
5 | ```html
6 |
7 | This is a simple details content
8 |
9 | ```
10 |
11 | ## Accordion with custom summary
12 |
13 | ```html
14 |
15 | View all details
16 | This is a details content with custom summary
17 |
18 | ```
19 |
20 | ## Pre-opened accordion
21 |
22 | ```html
23 |
24 | This is a simple details content
25 |
26 | ```
27 |
28 | ## Group of accordions mutually exclusive
29 |
30 | ```html
31 |
32 | Refrigerator 1
33 | Lunches, condiments, yogurt et al.
34 |
35 |
36 |
37 | Refrigerator 2
38 | More Lunches, leftovers from client meeting, stray cans of off-brand soda et
39 | al.
40 |
41 |
42 |
43 | Refrigerator 3
44 | Cookie dough someone bought from somebody’s child’s fundraiser, expired milk,
45 | unidentifiable meat et al.
46 |
47 | ```
48 |
49 | ---
50 |
51 | - [Quick Reminder that Details/Summary is the Easiest Way Ever to Make an Accordion](https://css-tricks.com/quick-reminder-that-details-summary-is-the-easiest-way-ever-to-make-an-accordion/)
52 | - [MDN: <details>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details)
53 | - [MDN: <summary>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary)
54 | - [Can I Use #details](https://caniuse.com/#feat=details)
55 | - [Lesser Known Uses Of Better Known Attributes](https://www.smashingmagazine.com/2025/01/lesser-known-uses-better-known-attributes/)
56 |
--------------------------------------------------------------------------------
/html/address.md:
--------------------------------------------------------------------------------
1 | # Address
2 |
3 | ## Generic postal address
4 |
5 | ```html
6 |
7 | W3C/MIT
8 | 32 Vassar Street
9 | Room 32-G515
10 | Cambridge, MA 02139 USA
11 |
12 | ```
13 |
14 | ---
15 |
16 | - [Markup for postal addresses](https://stackoverflow.com/a/26188004)
17 |
--------------------------------------------------------------------------------
/html/breadcrumb.md:
--------------------------------------------------------------------------------
1 | # Breadcrumb
2 |
3 | ## Breadcrumb navigation
4 |
5 | ```html
6 |
15 | ```
16 |
17 | ## Alternative version
18 |
19 | This version uses a `
` instead of `
` for the links
20 | ([taken from WHATWG](https://html.spec.whatwg.org/multipage/semantics-other.html#bread-crumb-navigation)).
21 | Useful if you have more than one path:
22 |
23 | ```html
24 |
38 | ```
39 |
40 | ---
41 |
42 | - [Common idioms without dedicated elements](https://www.w3.org/TR/html5/common-idioms-without-dedicated-elements.html#bread-crumb-navigation)
43 | - [Patrones diseño inclusivos - Víctor Rodríguez](https://youtu.be/B2vbQ57Tf-c)
44 |
--------------------------------------------------------------------------------
/html/buttons.md:
--------------------------------------------------------------------------------
1 | # Buttons
2 |
3 | ## Native button
4 |
5 | ```html
6 |
7 | ```
8 |
9 | ## Button to send a form
10 |
11 | ```html
12 |
13 | ```
14 |
15 | ## Link used as button
16 |
17 | Used only to triggering in-page functionality, rather than navigating to another
18 | document or section within the current page.
19 |
20 | ```html
21 | Link
22 | ```
23 |
24 | ## ON/OFF buttons
25 |
26 | ```html
27 |
28 |
29 |
30 |
31 |
32 | ```
33 |
34 | ---
35 |
36 | [Button state and accessibility](https://gomakethings.com/button-state-and-accessibility/)
37 |
--------------------------------------------------------------------------------
/html/cli.md:
--------------------------------------------------------------------------------
1 | # Command line interface
2 |
3 | ## Output of a program
4 |
5 | ```html
6 |
7 | When the process is complete, the utility will output the text
8 | Scan complete. Found N results.
9 |
10 | ```
11 |
12 | ## CLI
13 |
14 | Including the user input (with `kbd`) and sofware output:
15 |
16 | ```html
17 |
18 |
19 | git pull origin master
20 | Already up to date.
21 |
22 | ```
23 |
24 | ---
25 |
26 | - [The Sample Output element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/samp)
27 |
--------------------------------------------------------------------------------
/html/contact.md:
--------------------------------------------------------------------------------
1 | # Contact
2 |
3 | ## Email or social networks links
4 |
5 | ```html
6 |
7 | info@example.com,
8 | @example
9 |
10 | ```
11 |
12 | ---
13 |
14 | - [The Address Element](http://html5doctor.com/the-address-element/)
15 |
--------------------------------------------------------------------------------
/html/content-changes.md:
--------------------------------------------------------------------------------
1 | # Content changes
2 |
3 | ## Mark insertion and deletion of content
4 |
5 | ```html
6 | When dealing with a suspected yogurt thief , like Bob, we
7 | must create a special human resources group to deal with Bob
8 | the problem.
9 | ```
10 |
11 | ## Mark insertion and deletion of content, adding the date when the changes have made
12 |
13 | As an added note, screenreaders do not announce the datetime attribute in this
14 | context.
15 |
16 | ```html
17 | When dealing with a suspected yogurt thief , like Bob, we must create a human resources group to deal with Bob
22 | the problem.
23 | ```
24 |
25 | ---
26 |
27 | - [Lesser Known Uses Of Better Known Attributes](https://www.smashingmagazine.com/2025/01/lesser-known-uses-better-known-attributes/)
28 |
--------------------------------------------------------------------------------
/html/conversations.md:
--------------------------------------------------------------------------------
1 | # Conversations
2 |
3 | ## Simple conversation
4 |
5 | ```html
6 |
Costello: Look, you gotta first baseman?
7 |
Abbott: Certainly.
8 |
Costello: Who’s playing first?
9 |
Abbott: That’s right.
10 |
Costello becomes exasperated.
11 |
12 | Costello: When you pay off the first baseman every month, who gets the
13 | money?
14 |
15 |
Abbott: Every dollar of it.
16 | ```
17 |
18 | ## Chat conversation with time
19 |
20 | ```html
21 |
22 |
23 | egof I’m not that nerdy, I’ve only seen 30% of the star trek episodes
24 |
25 |
26 |
27 | kaj if you know what percentage of the star trek episodes you have
28 | seen, you are inarguably nerdy
29 |
30 |
31 |
32 | egof it’s unarguably
33 |
34 |
35 |
36 | * kaj blinks
37 |
38 |
39 |
40 | kaj you are not helping your case
41 |
42 | ```
43 |
44 | ---
45 |
46 | - [Common idioms without dedicated elements](http://w3c.github.io/html/common-idioms-without-dedicated-elements.html#conversations)
47 |
--------------------------------------------------------------------------------
/html/cookies-banner.md:
--------------------------------------------------------------------------------
1 | # Cookies banner
2 |
3 | Show a banner asking to manage cookies:
4 |
5 | ```html
6 |
7 | …
8 |
9 | ```
10 |
11 | ---
12 |
13 | - [Best intention barriers (ARIA edition)](https://marcus.io/blog/best-intention-barriers-aria)
14 |
--------------------------------------------------------------------------------
/html/creative-work.md:
--------------------------------------------------------------------------------
1 | # Creative Work
2 |
3 | How to reference a creative work such:
4 |
5 | - A book
6 | - A research paper
7 | - An essay
8 | - A poem
9 | - A musical score
10 | - A song
11 | - A play or film script
12 | - A film
13 | - A television show
14 | - A game
15 | - A sculpture
16 | - A painting
17 | - A theatrical production
18 | - A play
19 | - An opera
20 | - A musical
21 | - An exhibition
22 | - A legal case report
23 | - A computer program
24 | - A web site
25 | - A web page
26 | - A blog post or comment
27 | - A forum post or comment
28 | - A tweet
29 | - A Facebook post
30 | - A written or oral statement
31 | - And so forth.
32 |
33 | ## Reference a book
34 |
35 | ```html
36 |
The book Mr. Penumbra's 24-Hour Bookstore is good.
37 | ```
38 |
39 | ## Reference a book with a link
40 |
41 | ```html
42 |
7 | Interviewer: Good evening. I have with me in the studio tonight Mr
8 | Norman St John Polevaulter, who for the past few years has been contradicting
9 | people. Mr Polevaulter, why do you contradict people?
10 |
18 | [1] This is, naturally, a lie, but paradoxically if it
19 | were true he could not say so without contradicting the interviewer and thus
20 | making it false.
21 |