Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input tag html with close tag or not

Tags:

html

I know if input tag no need close tag input like this

<input type="text" value="Save">

but i will continue some web app and i see so many input tag with close tag like this

<input type="text" value="Save"></input>

I want to know, does this have an effect on something? I fear will have an effect on something in the future.

like image 234
Pajar Fathurrahman Avatar asked Jul 21 '16 08:07

Pajar Fathurrahman


1 Answers

You can make the tag closed, which would combine conciseness of HTML and strictness of XHTML:

<input type="text" value="Save" />

For further discussion, please refer to HTML 5: Is it <br>, <br/>, or <br />? but please keep in mind that the top-rated response there is very old. XHTML correctness is more important now than it was in 2009. Also, the closed tag tells the reader not to attempt to look for the closing tag, which makes the code more readable in my opinion.

like image 52
proski Avatar answered Sep 29 '22 21:09

proski