HTML Foundations·Practice drills 8

Drill 12: Why this way — Modern HTML elements

Explain why the example is written this way rather than another way.

Beginner 5 min read Lesson 207 of 480 Challenge included
What you will be able to do
  • Explain why the example is written this way rather than another way.

Practice task

Explain why the example is written this way rather than another way.

modern.htmlHTML
<details>
  <summary>Do I need an account?</summary>
  <p>Yes. Progress and certificates are tied to your account.</p>
</details>

<dialog id="confirm">
  <form method="dialog">
    <h2>Delete this note?</h2>
    <p>This cannot be undone.</p>
    <button value="cancel">Cancel</button>
    <button value="confirm">Delete</button>
  </form>
</dialog>

<button type="button" data-open="confirm">Delete note</button>

<label for="progress">Course progress</label>
<progress id="progress" value="7" max="12">7 of 12</progress>

<script>
  document.querySelector("[data-open]").addEventListener("click", () => {
    document.getElementById("confirm").showModal();
  });
</script>
Your turn

Write your answer

Easy

Explain why the example is written this way rather than another way.

TEXT · starter
Your answer…
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 207 of 480 · 0% of course