Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialFNU Christian
5,549 PointsForm Input does not have closing tag
Hello,
I just want to clarify, why does form INPUT does not have closing tag?
Lets say that the code is below
<input type="radio" name="gender" value="Male">Male
Why don't we do it like this
<input type="radio" name="gender" value="Male">Male</input>
Thank you before!
2 Answers
Hayden Taylor
5,076 PointsSome html elements such as the input element are single tags because they don't need a closing tag. Its about efficiency. Html has a bunch of tags which are like this. It boils down to "Element Content" which is anything you put between 2 tags where as the input tag: what kind of content would you want between it? These tags have specific functionality already and they aren't meant to be manipulated with adding content between them.
Jumah Hamilton
8,648 PointsChristian,
I am not sure what you are looking for but here is a stab at it.
'Form' does have a closing tag, 'Input' does not.. Not sure why this exists though.
<form>
<input>
</form>
FNU Christian
5,549 PointsFNU Christian
5,549 PointsThank you, very informative!