Attributes add meaning and behavior to elements β from links to images to accessibility labels.
alt text, and a link to an external pageid on the card container and class on at least two elements inside it<a> tag creates a link β but to where? An <img> tag shows an image β but which image?<tagname attribute-name="attribute-value">content</tagname>
href β Where a Link Goes<!-- External link -->
<a href="https://developer.mozilla.org">MDN Web Docs</a>
<!-- Internal link (same site) -->
<a href="/about">About Us</a>
<!-- Anchor link (jumps to a section on the same page) -->
<a href="#contact">Jump to Contact</a>
href, an <a> has no destination and wonβt navigate anywheresrc β Where an Image Comes From<!-- Image from the same folder -->
<img src="headshot.jpg" alt="Portrait of Maya Chen, lead designer">
<!-- Image from a subfolder -->
<img src="images/logo.png" alt="Studio logo">
<!-- Image from an external URL -->
<img src="https://example.com/banner.jpg" alt="Conference banner">
alt β What an Image Means<!-- Descriptive: explains what the image communicates -->
<img src="chart.png" alt="Bar chart showing sales growth of 42% from Q1 to Q4">
<!-- Decorative: alt="" tells screen readers to skip it entirely -->
<img src="decorative-swirl.png" alt="">
<!-- WRONG: missing alt attribute entirely β fails WCAG accessibility -->
<img src="photo.jpg">
alt="" is correct for purely decorative imagesalt is always wrong β itβs an accessibility failureclass and idclass β can be shared by multiple elementsid β unique; only one element per page can have a given ID<p class="intro-text">Welcome to the site.</p>
<p class="intro-text">This paragraph also uses that class.</p>
<section id="contact-form">
...
</section>
<div id="profile-card" class="card">
<img
src="avatar.jpg"
alt="Photo of Jordan Wells"
class="avatar"
>
<h2 class="profile-name">Jordan Wells</h2>
<p class="profile-bio">UX designer based in Seattle.</p>
<a href="https://jordanwells.design" class="profile-link">View Portfolio</a>
</div>