Thuta Learning
HTML
ProjectsWeb DevelopmentBeginner

Project 1: Profile Card

HTMLLesson 3340 min

What you'll walk away with

  • Order the card's content by importance and choose elements before writing any CSS
  • Explain why <article> suits a reusable card
  • Adjust heading levels to where the card is placed
  • Decide the avatar's alt text and write link text that differs from card to card
  • Explain what happens when a whole card is a link with more links inside

Explain it simply

Explain it simply

In this project you build a small card that introduces a person: a photo, a name, a role with a short bio, a list of skills and a contact link. It combines everything from earlier lessons (images, headings, lists, links and semantic tags) in one card.

Think of a business card. Before you pick colours and fonts, you decide what goes on it and what should be the biggest thing. HTML is that "what goes on it" step; CSS makes it pretty afterwards.

Problem → Why → Solution

The problem: a whole-card link with another link inside

On a team page, the developer wants a click anywhere on the card to open the profile page, so they wrap the whole card in an <a>. Then they add a GitHub link inside the card.

HTML does not allow a link inside another link. When the browser's parser meets the second <a>, it closes the first link right there. In the DOM, the GitHub link ends up outside the card link, and the CSS draws the bottom of the card in an unexpected way. A screen reader also reads the whole card link as one long name, something like "Sai Tun Sai Tun Web creator".

team.html
<!-- The parser closes the first <a> when it meets the second one -->
<a href="/team/sai-tun" class="card">
  <img src="sai.jpg" alt="Sai Tun">
  <h2>Sai Tun</h2>
  <p>Web creator</p>
  <a href="https://github.example/saitun">GitHub</a>
</a>

Why this happens

The content model of <a> does not allow interactive content (links, buttons, inputs) inside it. The browser shows no error; it silently repairs the markup, so what you see in the source and what exists in the DOM differ. The fix is to make only the name heading the profile link and keep the other links separate.

Core concept: plan the card by meaning

When you build a card, start from what the content means, not from a layout like "photo on the left, text on the right". The layout changes with screen size; the meaning does not. This project makes five decisions.

1. List the content in order of importance

Name, then role and bio, then skills, then contact. That order becomes the source order, which reads sensibly on a screen reader and on mobile even without CSS.

2. Choose the container

<article> is for self-contained content that could be reused elsewhere. A profile card can reappear on a team page, in a blog author box or in search results, so it fits. If a card has no standalone meaning, a <div> is not wrong either.

3. Pick heading levels from the context

A single card under the page's h1 gets an h2 for the name and an h3 for "Skills". Inside an "Our team" h2 section, the names become h3 and "Skills" becomes h4. Choose levels from the outline, never from font size.

4. Decide the avatar's alt text

The name is already next to the photo, so an alt that only repeats the name makes a screen reader say it twice. Choose an alt that adds what the photo shows ("Sai Tun smiling at a workshop"), or alt="" if the photo is purely decorative. width and height reserve the space before the image loads.

5. Make link text unique per card

Three cards with three "Contact me" links leave a screen reader's link list with no idea whose link is whose. Use link text that includes the person, such as "Email Sai Tun".

The order for building one card
  1. Rank the content by importance
  2. Pick the container and heading levels
  3. Image: alt plus width/height
  4. Links: unique text, never nested

With CSS switched off, the card should read like a short report; if it does not, fix the structure before styling.

General pattern

html
<article class="card">
  <img src="photo.jpg" alt="What the photo shows" width="N" height="N">
  <hN>Person's name</hN>
  <p>Role and short bio</p>
  <hN+1>Section label</hN+1>
  <ul><li>Item</li></ul>
  <a href="mailto:address">Action with the person's name</a>
</article>

hN depends on where the card sits; headings inside the card go one level lower, and the link text says whose action it is.

One profile card

The card below assumes it sits alone under the page's h1, so the name is an h2. profile.jpg is a placeholder: save your own photo next to the HTML file under that name. There is no CSS yet, so it appears with the browser's default styles, which is the best moment to check the structure.

html
<article class="profile-card">
  <img src="profile.jpg" alt="Sai Tun smiling" width="160" height="160">
  <h2>Sai Tun</h2>
  <p>AI automation learner and web creator building useful digital tools.</p>
  <h3>Skills</h3>
  <ul>
    <li>HTML basics</li>
    <li>AI content workflow</li>
    <li>Web project planning</li>
  </ul>
  <a href="mailto:hello@example.com">Contact me</a>
</article>

Code breakdown

  1. Reusable container<article class="profile-card">

    <article> marks the card as self-contained content. The class is only a hook for CSS and does not change the meaning.

  2. Photo with reserved space<img src="profile.jpg" alt="Sai Tun smiling" width="160" height="160">

    The alt adds what the photo shows ("smiling") beyond the name. Thanks to width/height, the 160×160 area exists before the image loads, so the text below does not jump.

  3. The card's main heading<h2>Sai Tun</h2>

    The name is the card's heading, so screen reader users who jump by heading can find each card by name.

  4. A sub-section of the card<h3>Skills</h3>

    One level below the h2, so the outline shows "Skills" belongs to Sai Tun. The <ul> below lets a screen reader announce how many skills there are.

  5. The contact action<a href="mailto:hello@example.com">Contact me</a>

    A mailto: link opens the visitor's email app. "Contact me" is fine for a single card, but switch to something like "Email Sai Tun" once several cards share a page.

You should see
Without CSS it reads top to bottom: a 160×160 photo area (a broken-image icon with the alt text "Sai Tun smiling" until you add profile.jpg), a large "Sai Tun" heading, the bio sentence, a smaller "Skills" heading, a list with three bullets and a "Contact me" link that opens the visitor's email app.

Making the whole card clickable the right way

If the whole card should be clickable, do not wrap it in <a>; put a link inside the name heading instead. Later, in CSS, you can stretch that link's ::after pseudo-element over the card (position: absolute; inset: 0) to enlarge the click area. In the HTML every link stays separate and valid, and a screen reader reads a short link name. Give the other links position: relative and a z-index so they sit above the pseudo-element.

html
<article class="profile-card">
  <img src="mya-mya.jpg" alt="" width="120" height="120">
  <h3><a href="/team/mya-mya">Mya Mya</a></h3>
  <p>UX researcher</p>
  <a href="https://github.example/myamya">Mya Mya on GitHub</a>
</article>

In real projects

In real projects

The profile card pattern appears on company "About us" pages, conference speaker lists, author boxes under blog posts and freelancer portfolios. The card is usually generated from data by a CMS or a React component, so one HTML template must serve people with long names, long bios and no photo at all.

That is why teams test the template with edge cases: how does a long name like "Aung Kyaw Moe Thant Zin" wrap on mobile, do cards with a five-line bio become uneven, should a missing photo show initials, and is the card still readable if the CSS fails to load? Many teams also avoid hard-coding the heading level inside the component and pass it in as a prop from the place that uses it.

Common mistakes

Common mistakes

Wrapping the card in a link and adding links inside

The parser closes the first link halfway, which breaks both the DOM and the styling. Put one link in the heading and keep the others separate.

Choosing heading levels by size

Making the name an h4 "because that size matches the design" makes the outline jump from h2 to h4. Pick the level from the structure and fix the size in CSS.

Writing "profile picture" or the file name as alt

alt="profile.jpg" or alt="image" gives no information. Describe what the photo shows, or use alt="" if it is decorative, but never drop the attribute, because screen readers may then read the file name.

Separating skills with <br>

Skills written as lines with <br> look like a list, but a screen reader does not announce "list, 3 items". If it is a set of items, use <ul>.

Mini challenge

A team section with two cards

Build a "Meet the team" section containing two profile cards. Because the cards now sit under a section heading, their heading levels change, and every link text must be unique to its card.

  • The page has one h1, and the section has an h2 "Meet the team"
  • Each card is an <article> with the name as h3 and "Skills" as h4
  • Every image has an alt describing the photo plus width/height
  • Contact links include the person's name (for example "Email Sai Tun")
team.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Our studio</title>
</head>
<body>
  <!-- TODO: h1 for the page -->
  <section>
    <!-- TODO: h2 "Meet the team" -->

    <!-- TODO: card 1 - article, photo (alt + size), h3 name, role/bio, -->
    <!--   h4 "Skills" + list, "Email <name>" mailto link -->

    <!-- TODO: card 2 - same structure, different person -->
  </section>
</body>
</html>

Expected: The browser shows the "Our studio" h1, the "Meet the team" h2 and two cards in order. Each card has a photo area (showing the alt text while the placeholder image is missing), an h3 name, a role line, an h4 "Skills", a bulleted list and an "Email Sai Tun" or "Email Mya Mya" link.

Show hint

Finish one card, copy it, then check that you changed all four: the name, the alt, the email and the link text. Copy-pasted cards usually forget the alt and the link text.

Show solution
team.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Our studio</title>
</head>
<body>
  <h1>Our studio</h1>
  <section>
    <h2>Meet the team</h2>

    <article class="profile-card">
      <img src="sai-tun.jpg" alt="Sai Tun presenting at a workshop"
           width="120" height="120">
      <h3>Sai Tun</h3>
      <p>Web creator who turns messy ideas into simple pages.</p>
      <h4>Skills</h4>
      <ul>
        <li>Semantic HTML</li>
        <li>Content planning</li>
      </ul>
      <a href="mailto:sai@example.com">Email Sai Tun</a>
    </article>

    <article class="profile-card">
      <img src="mya-mya.jpg" alt="Mya Mya sketching wireframes"
           width="120" height="120">
      <h3>Mya Mya</h3>
      <p>UX researcher who interviews real users every week.</p>
      <h4>Skills</h4>
      <ul>
        <li>User interviews</li>
        <li>Accessibility testing</li>
      </ul>
      <a href="mailto:mya@example.com">Email Mya Mya</a>
    </article>
  </section>
</body>
</html>

Quick quiz 1 / 3

If <a href="https://github.example/sai">GitHub</a> is placed inside <a href="/team/sai">, how does the browser build the DOM?

Quick quiz 2 / 3

Five cards on a team page each have a "Contact me" link. What is the problem?

Quick quiz 3 / 3

Cards sit inside a section headed <h2>Our team</h2>. Which heading level should the names in the cards use?

What to remember

  • Start a card from the importance order of its content, not from its layout
  • <article> suits a reusable card, and heading levels depend on where the card sits
  • Avatar alt text describes the photo, or is alt="" when the photo is decorative
  • Never put a link inside a link, and give every card unique link text

HTML Living Standard — WHATWG

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Project 1: Profile Card | Thuta Learning