Lesson 3 ยท about 15 minutes

๐Ÿ–ผ๏ธ More Bricks: Headings, Lists & Pictures

Your page has walls now. Today you get THREE new LEGO bricks โ€” and one brand-new superpower that makes pictures possible.

๐ŸŽฌ Watch first (90 seconds)

Headings come in sizes

You already know <h1>, the giant headline. But there's a whole family: <h1> down to <h6>. They are sizes of importance, like a book:

Bricks INSIDE bricks: lists

Here's a cool trick โ€” LEGO bricks can go inside other bricks. That's called nesting. A list is a big brick (<ul>, "unordered list") holding little bricks (<li>, "list item") inside it:

<ul>
  <li>Never melts</li>
  <li>Tastes like rainbows</li>
  <li>Glows in the dark</li>
</ul>

The browser draws a bullet point (โ€ข) before each item. Swap <ul> for <ol> ("ordered list") and the browser numbers them for you โ€” 1, 2, 3 โ€” perfect for top-3 lists or recipes.

One more mini-brick: wrap important words in <strong> and the browser makes them bold. It means "this bit really matters!"

The new superpower: attributes

๐Ÿ’ก The one idea of this lesson Some elements need extra info. You write it INSIDE the opening tag, like a sticky note on the brick. That extra info is called an attribute (it'll be in the glossary too!):
<img src="photo.jpg" alt="a red sneaker">
src says WHICH picture to show. alt describes the picture for people who can't see it (and it shows up if the picture breaks). And notice: <img> has NO closing tag โ€” it's a special self-contained brick. Nothing goes inside a picture, so it doesn't need one!

The pattern is always the same: name="value", with quotes around the value. You'll meet lots more attributes soon โ€” this is a big deal!

๐Ÿ› ๏ธ Build it (the fun part)

๐Ÿงช Your mission Give your product page a features list and its very first picture!
  1. Open practice/myshop.html in VS Code (the page you built in lessons 1 and 2).
  2. Inside <body>, under your paragraphs, add a chapter heading:
    <h2>Why it's awesome</h2>
  3. Under it, add a bullet list with 3 features of YOUR product (type it, don't copy!):
    <ul>
      <li>Ties itself in 2 seconds</li>
      <li>Never gets smelly</li>
      <li>Comes in <strong>glow-in-the-dark</strong> green</li>
    </ul>
  4. Now the picture! Add this line (it's a free placeholder photo from the internet):
    <img src="https://picsum.photos/300/200" alt="a photo of my product">
    Change the alt words to describe YOUR product.
  5. Save (โŒ˜S), then refresh your browser (โŒ˜R). Bullet points AND a photo. Your page is starting to look like a real shop! ๐ŸŽ‰

๐Ÿ•น๏ธ Try it right here โ€” the lesson checks your code!

Type in the dark box, watch the preview update live, then press Check my code โœ”.

๐Ÿ”จ Now break it!

Time to break things on purpose in myshop.html. Predict what will happen BEFORE you refresh!

  1. Change <ul> and </ul> to <ol> and </ol>. Save, refresh. Numbers! Change it back (unless you like it).
  2. Break the picture on purpose: change the src to "https://picsum.photos/oops". Save, refresh. You'll see a broken-picture icon and your alt text โ€” THAT is exactly what alt is for! Fix the src again.
  3. Change your <h2> to <h6>. Save, refresh. See how tiny? Now you know why chapter titles use h2. Put it back.
โš ๏ธ If your picture doesn't show at all Check the quotes! Attributes need them: src="...". Also check there's a space between img, src, and alt. And remember: save FIRST, then refresh.

๐ŸŽฎ Quiz time

No peeking at the notes above โ€” trying to remember is what makes it stick!

๐Ÿ“š Want more?

โญ Best thing to read next MDN: HTML images โ€” the official Mozilla guide to <img>, src and alt, with extra tricks like picture sizes. Reading it counts as a lesson block!