├── 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 `