If you have more than one <nav> present in your layout, it's best to label them so that users of assistive technology can use landmark navigation to traverse your page's hierarchy and know the difference between navigations.
This can be done with aria-label on the <nav>, or aria-labelledby which would point to the id of a labeling element.
Setting list-style: none in CSS can remove the list semantics announced to users of assistive technology. Including role="list" restores list semantics in that scenario.
Often in this scenario, the icon is considered decorative and so the aria-hidden attribute is included on the SVG. Additionally, for older IE support, focusable="false" ensures the SVG does not create an extra tab stop for keyboard users.
Note: An hr is intended as "a thematic break between paragraph-level elements" and should not be used for visual presentation only. If your intent is to provide a visual flourish, one alternative would be to add a class to the element before or after the visual break to add a styled border.
<article> <h2>Lorem ipsum dolor sit.</h2> <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. <strong>Reiciendis nulla iste temporibus voluptatem</strong> sed laudantium eos fugiat fuga qui inventore placeat ullam voluptate pariatur exercitationem obcaecati, veniam debitis quisquam velit.</p> <p>Ipsam nam iusto officia natus maxime inventore voluptatibus? Iste possimus veniam ipsum <ahref="#">repellendus, ad tenetur ullam saepe impedit error</a>. Corrupti quas animi autem rem fugit ratione eligendi vero labore facilis.</p> <hr> <p>Aliquam delectus id sunt possimus, culpa repudiandae recusandae eius ex distinctio dolor ipsum voluptatem nam accusamus enim quasi dolorum. Corporis, repellendus. Ullam doloremque quam amet odio est culpa optio totam.</p> <ul> <li>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</li> <li>Ut, ea rerum. Ipsa ullam iusto nihil aliquam.</li> <li>Reprehenderit veritatis officia dolores iste consequatur. Enim, voluptatibus?</li> </ul> <h3>Lorem ipsum dolor sit.</h3> <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Hic nesciunt tempora iure animi tenetur perspiciatis nam provident quas minima tempore dolorum necessitatibus blanditiis quia officiis modi similique, nihil at! Recusandae?</p> <h4>Lorem ipsum dolor sit amet consectetur adipisicing elit.</h4> <ul> <li>Lorem ipsum dolor sit.</li> <li>Eius excepturi voluptate quisquam.</li> <li>Placeat ut deleniti eveniet!</li> <li>Dolor neque ipsa dolores!</li> <li>Aspernatur consequuntur a ipsam!</li> </ul> <blockquote> <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Id ipsum quasi quidem voluptas aliquam?</p> </blockquote> <h2>Lorem ipsum dolor sit.</h2> <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit.</p> <ahref="#">Lorem, ipsum dolor.</a> </article>
Lorem ipsum dolor sit.
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Reiciendis nulla iste temporibus voluptatem sed laudantium eos fugiat fuga qui inventore placeat ullam voluptate pariatur exercitationem obcaecati, veniam debitis quisquam velit.
Ipsam nam iusto officia natus maxime inventore voluptatibus? Iste possimus veniam ipsum repellendus, ad tenetur ullam saepe impedit error. Corrupti quas animi autem rem fugit ratione eligendi vero labore facilis.
Aliquam delectus id sunt possimus, culpa repudiandae recusandae eius ex distinctio dolor ipsum voluptatem nam accusamus enim quasi dolorum. Corporis, repellendus. Ullam doloremque quam amet odio est culpa optio totam.
Lorem ipsum dolor sit amet consectetur, adipisicing elit.
Ut, ea rerum. Ipsa ullam iusto nihil aliquam.
Reprehenderit veritatis officia dolores iste consequatur. Enim, voluptatibus?
Lorem ipsum dolor sit.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Hic nesciunt tempora iure animi tenetur perspiciatis nam provident quas minima tempore dolorum necessitatibus blanditiis quia officiis modi similique, nihil at! Recusandae?
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Lorem ipsum dolor sit.
Eius excepturi voluptate quisquam.
Placeat ut deleniti eveniet!
Dolor neque ipsa dolores!
Aspernatur consequuntur a ipsam!
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Id ipsum quasi quidem voluptas aliquam?
Lorem ipsum dolor sit.
Lorem ipsum, dolor sit amet consectetur adipisicing elit.
To summarize MDN's article on the <aside> element, <aside> describes content that is somewhat or partially related to the document's main content. This makes it an option for sidebars!
The <aside> element is considered a landmark and comes with an implicit ARIA role of "complementary". It is intended to be a top-level landmark, meaning it should not nest within mainunless you change its role, for example to note. You should also change its role if it's not related to the main page content. The MDN docs show permitted ARIA roles for aside.
If using more than one on a page, each such include a label for assistive technology navigation. You can set it via an aria-label or use aria-labelledby to point to the id of a nested heading element.
<divclass="container"> <main> <article> <h2>Lorem ipsum dolor sit.</h2> <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. <strong>Reiciendis nulla iste temporibus voluptatem</strong> sed laudantium eos fugiat fuga qui inventore placeat ullam voluptate pariatur exercitationem obcaecati, veniam debitis quisquam velit.</p> <p>Aliquam delectus id sunt possimus, culpa repudiandae recusandae eius ex distinctio dolor ipsum voluptatem nam accusamus enim quasi dolorum. Corporis, repellendus. Ullam doloremque quam amet odio est culpa optio totam.</p> </article> </main> <aside> <figure> <imgsrc="https://source.unsplash.com/400x300/?beagle"alt=""width="200"height="100"> <figcaption>Lorem ipsum dolor sit.</figcaption> </figure> </aside> </div>
Lorem ipsum dolor sit.
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Reiciendis nulla iste temporibus voluptatem sed laudantium eos fugiat fuga qui inventore placeat ullam voluptate pariatur exercitationem obcaecati, veniam debitis quisquam velit.
Aliquam delectus id sunt possimus, culpa repudiandae recusandae eius ex distinctio dolor ipsum voluptatem nam accusamus enim quasi dolorum. Corporis, repellendus. Ullam doloremque quam amet odio est culpa optio totam.
Usually an image, illustration, diagram, code snippet, etc. Read about the <figure> tag and its uses here at MDN. If your use case doesn't require a caption, the <figcaption> can be omitted.
Writing separate content for the <figcaption> element and the image's alt attribute can be a confusing. Generally speaking the alt attribute should describe the contents of the picture, while the <figcaption> element's purpose can vary depending on the nature of the <figure> it's captioning. Be sure to include the alt description or else the figcaption is essentially captioning nothing as far as users of some assistive technolgy can tell.
<figure> <imgsrc="https://source.unsplash.com/400x300/?dinosaur"alt="alternative text required here, the example image is a dinosaur-related photo from a dynamic API"width="400"height="300"> <figcaption>Lorem ipsum dolor sit.</figcaption> </figure>
The <address> element's use case has evolved over time and is now acceptable for marking up arbitrary contact information. The browser inherited styles are the same as for <i> or <em>.
MDN states that an address element "may include any type of contact information that is needed" and includes more examples of using address. However, it should be noted there is no implicit role for this element as provided to assistive technology users.
<address> <ahref="mailto:fake@htmlrecipes.dev">📧 fake@htmlrecipes.dev</a> <ahref="tel:+5551231234">📞 (555) 123-1234</a> 🏠 123 Sesame Street<br> New York, NY 10123 </address>
For your use case, a series of <article> may be more appropriate.
If you are using a list as shown, and you want to retain list semantics for users of assistive technology by having the current list item and it's order announced, adding role="list" is required. Otherwise, the use of list-style: none can remove list semantics for some assistive technology.
<ulrole="list"> <li> <imgsrc="https://source.unsplash.com/400x300/?corgi"alt=""width="400"height="300"> <h3>Lorem ipsum dolor sit.</h3> <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.</p> </li> <li> <imgsrc="https://source.unsplash.com/400x300/?dolphin"alt=""width="400"height="300"> <h3>Quam ut enim quo.</h3> <p>Suscipit earum magnam porro molestias fugiat! Dicta, dolor.</p> </li> <li> <imgsrc="https://source.unsplash.com/400x300/?kitten"alt=""width="400"height="300"> <h3>Quis dolor ipsam ea!</h3> <p>Repudiandae nihil laudantium quae necessitatibus sint facilis. Unde?</p> </li> </ul>
Lorem ipsum dolor sit.
Lorem ipsum dolor, sit amet consectetur adipisicing elit.
Quam ut enim quo.
Suscipit earum magnam porro molestias fugiat! Dicta, dolor.
Quis dolor ipsam ea!
Repudiandae nihil laudantium quae necessitatibus sint facilis. Unde?
<details> <summary>Proin eget velit vel lectus elementum pharetra?</summary> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tristique venenatis dui eget iaculis. Donec varius metus at augue sollicitudin, vitae cursus dui faucibus. Quisque vulputate pulvinar ante at congue. </details>
<details> <summary>Vivamus consectetur orci sed eros ultricies tincidunt?</summary> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur mattis, purus vitae dapibus tincidunt, purus purus maximus libero, et auctor est lacus id nunc. Cras convallis gravida nulla eu vulputate. </details>
<details> <summary>Lorem ipsum dolor sit amet?</summary> Aenean in nunc lectus. Morbi nec sem auctor, tincidunt nisl nec, rutrum nisl. Nulla viverra id enim ut fringilla. Morbi vulputate bibendum. </details>
Proin eget velit vel lectus elementum pharetra?
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tristique
venenatis dui eget iaculis. Donec varius metus at augue sollicitudin,
vitae cursus dui faucibus. Quisque vulputate pulvinar ante at congue.
Vivamus consectetur orci sed eros ultricies tincidunt?
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur mattis,
purus vitae dapibus tincidunt, purus purus maximus libero, et auctor est
lacus id nunc. Cras convallis gravida nulla eu vulputate.
Lorem ipsum dolor sit amet?
Aenean in nunc lectus. Morbi nec sem auctor, tincidunt nisl nec, rutrum nisl.
Nulla viverra id enim ut fringilla. Morbi vulputate bibendum.
Generally, you will need some sort of backend process to handle form submissions. You can handle this on your own on the server side by setting the action and method attributes, or you may choose a web host that offers form processing as a service.
Make sure to include labels for each input, as well as setting the proper type of input. You can also mark inputs as required by including the required attribute. Modern browsers have built-in (though fairly basic) form validation.