Pajar Fathurrahman
Pajar Fathurrahman

Reputation: 1021

Input tag html with close tag or not

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.

Upvotes: 8

Views: 8480

Answers (1)

proski
proski

Reputation: 3949

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.

Upvotes: 7

Related Questions