- Use the W3C's Markup Validation Service to validate HTML
- Prefer double quotes for attributes.
- Use lowercase text for elements and attributes
- Use double quotes to wrap element attributes
- Use closing tags for all normal elements
- Prefer a HTML5 doctype
- Ensure elements are scoped properly
- Elements such as
<title>
and<meta>
must be placed within the page's<head>
element - Elements such as
<p>
,<nav>
,<div>
, etc. should be placed within the page's<body>
element
- Elements such as
- Ensure
id
s are unique - Prefer appending attribute values instead of declaring redundant attribute
names
- For example, if adding a class of
c-card--featured
, add it to the existing class declaration (class="c-card c-card--featured"
, notclass="c-card" class="c-card--featured"
)
- For example, if adding a class of
- Avoid using emoji and other exotic characters as values for attributes such as
class
,id
,data
, andaria-*
. - Avoid restricting viewport zooming
- Ensure parent elements contain no more than 60 child elements
- Use
<button>
elements instead of<a>
elements for actions.- Use
type="button"
for button elements used outside of forms to prevent the browser from trying to submit form data - Use a
href
attribute for<a>
elements with a valid location
- Use
- Ensure heading elements are used to section content, and heading levels are not skipped