且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

输入标签HTML与关闭标签或不

更新时间:2023-09-18 12:17:22

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.

推荐文章