Home  >  Q&A  >  body text

input最后那加个斜杠有什么用呢?

去掉也可以实现效果

phpcn_u226phpcn_u2262756 days ago1769

reply all(3)I'll reply

  • 清晨的那一抹阳光照耀在我的脸上

    清晨的那一抹阳光照耀在我的脸上2018-01-22 20:46:44

    Can be added or not

    Reply
    0
  • 数据分析师

    数据分析师2017-09-30 22:49:09

    What is the use of adding a slash at the end of input? -PHP Chinese website Q&A-What is the use of adding a slash at the end of input? -PHP Chinese website Q&A

    Please watch and learn.

    Reply
    0
  • 阿神

    阿神2016-12-17 15:06:26

    没有内容的 HTML 内容被称为空元素。空元素是在开始标签中关闭的。

    <input /> 就是没有关闭标签的空元素(<input /> 标签定义换行)。

    在 XHTML、XML 以及未来版本的 HTML 中,所有元素必须被关闭。

    在开始标签中添加斜杠,比如 <input />,是关闭空元素的正确方法,HTML、XHTML 和 XML 都接受这种方式。

    即使 <input> 在所有浏览器中都是有效的,但使用 <input /> 其实是更长远的保障。

    Reply
    0
  • CancelReply