+ 6

Confusion in HTML tags

Some HTML tags have ending tags like <a> has ending tag </a>. while others don't have ending tags like meta tags in head section or input tags or some other. So how can we remember which tag has ending tag and which has not?

24th Feb 2019, 3:27 AM
Saadat Ali
Saadat Ali - avatar
8 Answers
+ 5
Alternatively, you can run your code through a validation service. There are lots of free validators. They will tell you when you're missing something. Example: https://validator.w3.org/
24th Feb 2019, 1:52 PM
Janning⭐
Janning⭐ - avatar
+ 3
The easy and best way is practice. Use what you learn and make some project combine of these tag!
24th Feb 2019, 4:07 AM
Thống Nguyễn
Thống Nguyễn - avatar
+ 3
As a general rule, tags that go around something obviously have open and close. Tags that don’t go around something generally don’t have to have closing tags, but they still can. Best explanation is examples: <a href=“site.com”>link text</a> <b>bold text</b> <meta name=“description” content=“page description”> <br> To close those last 2, just add a space and / at the end. <meta name=“description” content=“page description” /> <br /> Now they are closed too. Like pp said, practice is best way to learn.
24th Feb 2019, 4:22 AM
Mike
Mike - avatar
24th Feb 2019, 10:45 AM
BroFar
BroFar - avatar
+ 3
You remember it when you have practice them in real projects. In addition you should use google for searching all of time, when you are beginner or professional
24th Feb 2019, 8:55 PM
parsa rashedi
parsa rashedi - avatar
+ 3
Saadat Ali, that is a very nice question but I think we shouldn't beat around the bush, the answer to your question is "by practicing and using various tags often". I hope this helps
25th Feb 2019, 10:47 PM
Precious
Precious - avatar