Skip to content

Courses / HTML5 Mastery: Complete Beginner to Advanced Course / Elements, Tags, Attributes

695 people viewed this

Elements, Tags, Attributes

  • A — Incorrect: The word "false" does not disable a Boolean attribute.
  • B — Incorrect: The attribute is still present in the markup.
  • C — Correct: Boolean attributes are true when present. Remove required to make the control not required.
  • D — Incorrect: required does not delete an element.

Question 6: Which example shows correct nesting?

  1. <p><strong>Hello</p></strong>
  2. <p><strong>Hello</strong></p>
  3. <p><strong>Hello</p>
  4. </strong>Hello<p>

Correct answer: B

  • A — Incorrect: The paragraph closes before the nested strong element.
  • B — Correct: The inner strong element closes before the outer paragraph.
  • C — Incorrect: The strong element has no explicit closing tag in this example, and the nesting is incomplete.
  • D — Incorrect: The closing strong tag appears before its corresponding opening tag.

Question 7: Which statement about id and class is correct?

  1. An ID should be unique within the document, while classes can be reused
  2. Every element must have an ID
  3. A class can only be assigned to one element
  4. An ID is used only for image files

Correct answer: A

  • A — Correct: IDs identify individual elements, while classes support reusable grouping and styling.
  • B — Incorrect: Most HTML elements do not require an ID.
  • C — Incorrect: The same class can be used on many elements.
  • D — Incorrect: IDs can identify many kinds of elements, not only images.

Question 8: What is the problem with this markup?

<div class="card" class="featured">Course</div>
  1. HTML elements cannot have classes
  2. The div element is a void element
  3. The same attribute is repeated twice
  4. Text cannot appear inside a div

Correct answer: C

  • A — Incorrect: A div can have a class attribute.
  • B — Incorrect: A div is not a void element.
  • C — Correct: The class attribute is duplicated. Use class="card featured" instead.
  • D — Incorrect: A div can contain text and other permitted content.

Question 9: Why should you quote attribute values consistently?

  1. HTML requires every attribute value to be a number
  2. Quotes make values containing spaces safe to parse and improve readability
  3. Quotes automatically validate all URLs
  4. Quotes turn every attribute into a Boolean attribute

Correct answer: B

  • A — Incorrect: Attribute values can be text, URLs, numbers, and other permitted values.
  • B — Correct: Quoting avoids ambiguity for values with spaces and makes markup more readable.
  • C — Incorrect: Quotes do not validate whether a URL is safe or correct.
  • D — Incorrect: Quoting a value does not change the attribute's type.

Question 10: What is the best way to check whether your HTML markup conforms to HTML rules?

  1. Check only whether the page looks correct
  2. Use an HTML validator and inspect the DOM in browser Developer Tools
  3. Remove every closing tag
  4. Put every element inside a paragraph

Correct answer: B

  • A — Incorrect: Browsers can recover from invalid markup, so visual appearance alone does not prove conformance.
  • B — Correct: An HTML validator can report conformance problems, and Developer Tools help you inspect the parsed DOM.
  • C — Incorrect: Many elements require closing tags, and removing them indiscriminately creates errors.
  • D — Incorrect: Paragraphs have content restrictions and cannot contain arbitrary elements.

19. Recommended Practice Before Moving On

Rate this course

5.0 · 1 rating

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

Your stars