gpt4 book ai didi

javascript - 为什么我应该使用 & 而不是 &?

转载 作者:太空狗 更新时间:2023-10-29 13:22:57 25 4
gpt4 key购买 nike

在为我的网站编写 HTML 时,为什么我应该使用 & 而不是 &

我在哪里可以找到我应该编码的其他符号的列表? (酒吧/也是,对吧?)

如果我将符号按原样粘贴到 html 中,我会遇到什么问题?

问题是,我有几个附属链接,我担心如果我在某些情况下用 & 写它们,出于某些原因,因为特定的浏览器或设备。 .. url 中的信息不会被正确传递。

希望有人能理清我的思绪?

谢谢!

最佳答案

来自 https://developer.mozilla.org/en-US/docs/Glossary/Entity

HTML has a set of four reserved characters that must be represented as entities. All other characters can be represented with entities as needed, but it is not mandatory. These are the entities used for those four reserved characters :

  • & (&) - Required, so that a browser does not misinterpret it as the beginning of an entity.
  • &lt; (<) - Required because otherwise a browser could misinterpret it as the beginning of a tag
  • &gt; (>) - Required because otherwise a browser could misinterpret it as the ending of a tag
  • &quot; (") - Required only within attributes value surrender by quote sign

有关所有 HTML 字符实体的完整列表,请参见此处 - https://dev.w3.org/html5/html-author/charref

关于javascript - 为什么我应该使用 & 而不是 &?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35367945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com