0
0
HTMLmarkup~20 mins

Self-closing tags in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Self-Closing Tag Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
Identify the correct self-closing tag syntax
Which option shows the correct way to write a self-closing tag in HTML5?
A<img src="image.png" / >
B<img src="image.png" />
C<img src="image.png">
D<img src="image.png"></img>
Attempts:
2 left
💡 Hint
In HTML5, some tags do not need a closing slash to be self-closing.
rendering
intermediate
2:00remaining
Visual output of self-closing tags
What will the browser display when rendering this HTML snippet?
<input type="text" value="Hello">
HTML
<input type="text" value="Hello">
AAn error message in the browser
BThe text 'Hello' displayed as plain text
CNothing visible on the page
DA text input box with the text 'Hello' inside
Attempts:
2 left
💡 Hint
Think about what an tag does in a form.
🧠 Conceptual
advanced
2:00remaining
Understanding self-closing tags in HTML5
Which statement about self-closing tags in HTML5 is true?
ASelf-closing tags like <br> and <img> do not require a closing slash in HTML5.
BAll self-closing tags must include a slash before the closing angle bracket.
CSelf-closing tags cannot have any attributes.
DSelf-closing tags must always have a separate closing tag.
Attempts:
2 left
💡 Hint
Think about how HTML5 simplified tag syntax compared to XHTML.
selector
advanced
2:00remaining
CSS selector targeting self-closing tags
Which CSS selector correctly targets all elements that are self-closing in the HTML document?
Ainput
Binput:empty
Cinput::before
Dinput > *
Attempts:
2 left
💡 Hint
Remember how self-closing tags behave in the DOM tree.
accessibility
expert
2:00remaining
Accessibility considerations for self-closing tags
Which practice improves accessibility for self-closing tags?
AUse a closing tag like <img></img> to improve screen reader support.
BAlways include an alt attribute describing the image content.
CAvoid using alt attributes to reduce page size.
DUse inline styles to hide the image from screen readers.
Attempts:
2 left
💡 Hint
Think about how screen readers understand images.