0
0
HTMLmarkup~5 mins

Self-closing tags in HTML - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a self-closing tag in HTML?
A self-closing tag is an HTML tag that does not need a separate closing tag. It ends with a slash before the closing angle bracket, like <br />. It is used for elements that don’t wrap any content.
Click to reveal answer
beginner
Give three examples of common self-closing tags in HTML.
Common self-closing tags include:<br>
  • <br /> for line breaks
  • <img /> for images
  • <input /> for form inputs
Click to reveal answer
beginner
Why do self-closing tags not have separate closing tags?
Because these tags do not contain any content inside them, they don’t need a closing tag. The slash at the end tells the browser the tag is complete on its own.
Click to reveal answer
intermediate
Is <br> valid without the slash in HTML5?
Yes, in HTML5 the slash is optional for self-closing tags like <br>. Browsers understand it as self-closing even without the slash.
Click to reveal answer
intermediate
What is the difference between self-closing tags in HTML and XHTML?
In XHTML, self-closing tags must always have the slash (e.g., <br />) because it is XML-based and requires strict syntax. HTML5 is more flexible and allows the slash to be optional.
Click to reveal answer
Which of these is a correct self-closing tag in HTML5?
A<span />
B<div />
C<p />
D<img src="image.jpg" />
What does the slash in a self-closing tag mean?
AIt closes the previous tag
BIt starts a comment
CIt marks the tag as complete without content inside
DIt is optional and has no meaning
Which tag is NOT typically self-closing?
A<input />
B<section />
C<hr />
D<br />
In HTML5, is <br> without a slash valid?
AYes, it is valid
BNo, it must have a slash
COnly in XHTML
DOnly in older HTML versions
Why do self-closing tags improve writing HTML?
AThey reduce code by not needing closing tags
BThey add comments automatically
CThey make tags colorful
DThey slow down the browser
Explain what a self-closing tag is and why it is used in HTML.
Think about tags that don’t wrap text or other elements.
You got /4 concepts.
    Describe the difference between self-closing tags in HTML5 and XHTML.
    Consider the syntax rules of XML vs HTML.
    You got /4 concepts.