Skip to content

Courses / HTML5 Mastery: Complete Beginner to Advanced Course / HTML Attributes & Selectors

696 people viewed this

HTML Attributes & Selectors

  1. To automatically save form data
  2. To make a suitable element focusable in the normal sequential keyboard navigation order
  3. To hide an element from assistive technology
  4. To apply a CSS class to the element

Correct answer: B

  • A — Incorrect: tabindex does not save data.
  • B — Correct: tabindex="0" can include an otherwise non-focusable element in the normal sequential focus order, but keyboard behavior must still be implemented where needed.
  • C — Incorrect: tabindex does not hide content from assistive technology.
  • D — Incorrect: CSS classes are assigned through the class attribute.

Question 10: Which statement about data attributes and security is correct?

  1. Data attributes are always hidden from users
  2. Data attributes can securely store passwords
  3. Users can inspect and modify data attributes, so sensitive operations require server-side validation
  4. Data attributes automatically validate product prices

Correct answer: C

  • A — Incorrect: Data attributes can be inspected through page source or browser Developer Tools.
  • B — Incorrect: They are not secure storage for passwords or secrets.
  • C — Correct: Client-side values can be changed, so the server must validate prices, permissions, ownership, and sensitive operations.
  • D — Incorrect: Data attributes only store values; they do not automatically validate business rules.

13. Final Checklist

Before moving to Section 6, make sure you can:

  • Explain what global attributes are.
  • Use IDs for unique identification and classes for reusable styling or behavior.
  • Use CSS ID and class selectors correctly.
  • Read and write data attributes using JavaScript's dataset property.
  • Convert data attribute strings into appropriate JavaScript data types.
  • Use contenteditable for basic editable regions and understand its limitations.
  • Explain the purposes of title, lang, dir, hidden, tabindex, spellcheck, draggable, and translate.
  • Recognize that hidden elements and data attributes do not provide security.
  • Use browser Developer Tools to inspect attributes and DOM changes.

Next section: Section 6 — Comments, Entities, Unicode and Special Characters.

End of Section 5 — Codementrix HTML5 Mastery.

Rate this course

5.0 · 1 rating

Stars show on this course. Your written note stays private.

Your stars