Week 11
Week 11
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
Explanation:
<ul> creates an unordered list (bulleted).
<ol> creates an ordered list (numbered).
Each list item is defined with <li> tags.
6. Divisions
The <div> tag is used as a container for other elements. It helps in grouping content together:
xml
<div class="container">
<h2>Title Inside Div</h2>
<p>This paragraph is inside a div.</p>
</div>
Explanation:
The <div> element does not inherently represent anything; it simply groups elements
for styling or scripting purposes.
7. Spans
The <span> tag is used for inline grouping of text or other elements:
xml
<p>This is a <span style="color:red;">red text</span>.</p>
Explanation:
The <span> element can be styled without breaking the flow of text.
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<label for="interests">Interests:</label><br/>
<input type="checkbox" id="coding" name="interests" value="coding">
<label for="coding">Coding</label><br/>
<article> Represents self-contained content that could be distributed independently (e.g., blog posts).
<nav role="navigation">
<ul aria-label="Main Navigation">
<li><a href="#home">Home</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact Us</a></li>
</ul>
</nav>
<main role="main">
<!-- Main Content -->
<article aria-labelledby='article-title'>
<!-- Using aria-labelledby to associate header with article -->
<header id='article-title'><h2>Article Title</h2></header>
<!-- Main Article Content -->
...
<!-- Footer -->
...
</article>
...
<!-- Additional Sections -->
...
...
</main>
<footer role='contentinfo'>
© 2024 My Website
</footer>
Explanation:
In this example:
The header contains site-wide information.
The navigation section provides links to different parts of the site.
The main section contains articles or primary content.
Using semantic elements improves SEO and accessibility by providing context
about different parts of your webpage.
ARIA Roles
The Accessible Rich Internet Applications (ARIA) specification provides additional attributes
that can enhance accessibility by defining roles for UI components.
Common ARIA Roles
Role Description
<nav role='navigation'>
<!-- Navigation Links -->
<ul aria-label='Main Navigation'>
<li><a href='#home'>Home</a></li>
<li><a href='#services'>Services</a></li>
<li><a href='#contact'>Contact Us</a></li>
</ul>
</nav>
<main role='main'>
<!-- Main Content -->
<article aria-labelledby='article-title'>
<header id='article-title'><h2>Article Title</h2></header>
<p>This article discusses...</p>
<footer>Published on October 19, 2024</footer>
</article>
</main>
<footer role='contentinfo'>
© 2024 My Website
</footer>
Explanation:
In this example:
The header uses ARIA roles to define its purpose clearly.
Navigation links are easily identified by screen readers due to their specified roles.
Using ARIA roles enhances accessibility by providing additional context about elements on
your page.
Conclusion
Understanding HTML is fundamental for anyone interested in web development. By
mastering its structure, essential tags, forms, semantic elements, and accessibility practices,
you can create effective and user-friendly websites.This overview has
provided foundational knowledge about HTML necessary for building modern web
applications while emphasizing best practices in accessibility to ensure inclusivity across
diverse user groups.As you continue your journey in web development:
1. Explore CSS (Cascading Style Sheets) to style your webpages effectively.
2. Learn JavaScript to add interactivity and dynamic features.
3. Consider frameworks like Bootstrap or libraries like React.js to enhance your
development skills further.
By combining these skills with your understanding of HTML, you'll be well-equipped
to create dynamic and engaging