Module 2
Module 2
🎯 Learning Outcomes:
By the end of this module, students should be able to:
Semantic HTML refers to the use of HTML elements that convey meaning about their
content and role in a webpage. Unlike non-semantic elements like <div> and <span>,
semantic elements provide structure and context, improving accessibility, readability,
and SEO.
1
2
WHAT IS ARIA?
Accessible Rich Internet Applications (ARIA) is a set of attributes that enhance the
accessibility of web content and applications for users with disabilities. ARIA helps
improve the experience for people who use assistive technologies, such as screen
readers, by providing additional context and roles for dynamic content and interactive
elements.
Best Practices:
By combining Semantic HTML with ARIA, developers can create accessible, well-
structured, and user-friendly web applications.
Semantic HTML plays a crucial role in responsive design by enhancing both the
structure and accessibility of web content. Here’s how it contributes:
2
3
By using semantic HTML in responsive design, developers create web pages that are
more maintainable, user-friendly, and adaptable to different screen sizes and
resolutions.
Non-Semantic Approach:
<div class="header">Website Header</div>
<div class="nav">Navigation Links</div>
<div class="content">Main Content</div>
<div class="footer">Footer Information</div>
o🛑 Issues: Screen readers don’t understand the purpose of these <div>
elements.
o 🚫 No clear structure or meaning.
Semantic Approach:
<header>Website Header</header>
<nav>Navigation Links</nav>
<main>Main Content</main>
<footer>Footer Information</footer>
3
4
Sometimes, semantic HTML alone is not enough, and ARIA attributes help improve
accessibility.
MORE READINGS…………….
Skipping Levels (Avoided): Skipping heading levels (e.g., jumping from <h1> to
<h3>) can disrupt the logical flow for assistive technologies.
Labeled Inputs (Recommended): Use <label for="id"> to associate labels with form
elements, ensuring screen readers announce the field purpose.
Fieldset and Legend (Recommended): <fieldset> groups related fields, and
<legend> provides context, improving comprehension.
Placeholder-only Text (Avoided): Relying on placeholders instead of labels can
cause accessibility issues, as placeholders disappear on typing.
Buttons vs. Links (Recommended): Use <button> for actions (e.g., form
submissions) and <a> for navigation to ensure expected behavior.
Keyboard Navigability (Recommended): Ensure interactive elements can be
accessed using the keyboard (e.g., tab key for navigation).
Div-based Clickable Elements (Avoided): Using <div> or <span> with JavaScript
for interactions without proper ARIA roles hinders accessibility.
5
6
Conclusion
6
7
<li><a href="#about">About</a></li>
<li><a href="#projects">Projects</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
</main>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<button type="submit">Send</button>
</form>
</aside>
</body>
</html>
7
8
1. <header> – Defines the header section containing the page title and navigation
menu.
2. <nav> – Wraps the main navigation links to help screen readers and search
engines understand the site structure.
3. <main> – Contains the primary content of the page, improving accessibility.
4. <section> – Organizes content into meaningful sections (About, Projects).
5. <article> – Encapsulates independent pieces of content (each project).
6. <aside> – Contains supplementary content (contact form).
7. <footer> – Includes copyright and additional information.