nerdexam
CIW

1D0-61B · Question #55

Clyde is working on a Web page for his company's intranet. He wants to insert an HTML comment within the page to let other developers know that the page validates as HTML5 and that he is the page…

The correct answer is D. <!--Clyde Davis, 9/17/2012. This code validates to HTML5-->. Option D uses the correct HTML comment syntax: <!-- content -->, where <!-- opens the comment and --> closes it - this is the only comment format recognized by HTML parsers, including HTML5. Option A (//) is JavaScript's single-line comment syntax and is ignored by HTML…

HTML5 Coding

Question

Clyde is working on a Web page for his company's intranet. He wants to insert an HTML comment within the page to let other developers know that the page validates as HTML5 and that he is the page author. Which line of code will insert the comment that Clyde requires?

Options

  • A// Clyde Davis, 9/17/2012. This code validates to HTML5
  • B<? Clyde Davis, 9/17/2012. This code validates to HIML5?>
  • C/*Clyde Davis, 9/17/2012. This code validates to HTML5 */
  • D<!--Clyde Davis, 9/17/2012. This code validates to HTML5-->

How the community answered

(54 responses)
  • A
    4% (2)
  • B
    2% (1)
  • D
    94% (51)

Explanation

Option D uses the correct HTML comment syntax: <!-- content -->, where <!-- opens the comment and --> closes it - this is the only comment format recognized by HTML parsers, including HTML5. Option A (//) is JavaScript's single-line comment syntax and is ignored by HTML parsers. Option B (<? ?>) resembles PHP processing instruction syntax, which is not valid in HTML. Option C (/* */) is the block comment syntax used in CSS and JavaScript, not HTML.

Memory tip: Think of HTML comments as "arrows hugging a dash" - the opening <!-- looks like an arrow pointing right, and the closing --> points left, as if they're "wrapping" your comment text.

Topics

#HTML comments#Comment syntax#HTML5#Markup

Community Discussion

No community discussion yet for this question.

Full 1D0-61B Practice