0
is it a must to write input tag like <input /> instead of <input> </input>
what is the difference between <input /> and <input></input> tags
6 Réponses
+ 1
It must be written in <input /> only.
Because it is language syntax and we must follow it in order to make it work.
Hope this helps ☺️☺️.
+ 1
It is one of those tag which has no ending tag.
Also modern editors supports <input>.
No need of /.
0
thank you
0
<input type="radio" mane="gender" value="male">male</input>
<input type="radio" mane="gender" value="male" />male
The results are the same, please run this code and see.
0
Thanks guys your so helpfull
The W3C validator doesn't like self-closing tags (those that end with "/>") on non-voidelements. (Void elements are those that may not ever contain any content.) Are they still valid in HTML5?
Some examples of accepted void elements:
<br /> <img src="" /> <input type="text" name="username" />
Some examples of rejected non-void elements:
<div id="myDiv" /> <span id="mySpan" /> <textarea id="someTextMessage" />
Note: the W3C validator actually accepts void self-closing tags: the author originally had a problem because of a simple typo (\> instead of />). However, self-closing tags are not 100% valid in HTML5 in general, and the answers elaborate on the issue of self-closing tags across various HTML flavors.