Structure HTML templates using semantically appropriate elements rather than generic containers. Replace non-semantic elements like `
` with more meaningful elements such as `
Structure HTML templates using semantically appropriate elements rather than generic containers. Replace non-semantic elements like <div>
and <p>
with more meaningful elements such as <nav>
, <ol>
, <ul>
, and include proper accessibility attributes like aria-labelledby
and aria-current
.
Example:
<!-- Instead of this -->
<p class="paginator">
</p>
<!-- Use this -->
<nav class="paginator" aria-labelledby="pagination">
<h2 id="pagination" class="visually-hidden">Pagination</h2>
<ul>
</ul>
</nav>
This improves code organization and readability while enhancing accessibility for users with assistive technologies. Proper semantic structure also makes templates more maintainable as the code’s purpose is clearer to other developers.
Enter the URL of a public GitHub repository