Manikanta
asked

Expert
Abhay Jajodia answered
The tags and essentially do the same thing: create a line break in the text. The difference lies in how HTML has evolved over time.
: This is the traditional way to insert a line break in HTML. It’s perfectly valid and widely used when you just need a simple line break.
: This version is more commonly used in XHTML (a stricter version of HTML). The/is added to indicate that it’s a self-closing tag—a practice XHTML enforces to ensure tags are properly closed.
In compatible HTML5, both are acceptable, so it's mostly about which style you prefer or are required to use.
Just remember not to close a self-closing tag in this way: —this is incorrect.
Hope this helps clear things up! Let me know if you have more questions.
HTML
This question was asked as part of the Learn HTML course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer