我为什么要使用& amp;而不是&amp ;? [英] Why should I use & instead of &?

查看:241
本文介绍了我为什么要使用& amp;而不是&amp ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

why should I use & instead of & when writing HTML for my site?

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

Where can I find a list of other symbols that I should be encoding? (the bar / too, right?)

如果将符号原样粘贴到html中会出现什么问题?

What problems could I have if I paste the symbol right as it is into the html?

问题是,我有一些会员链接,但我担心如果我用&在某些情况下,由于某些原因,由于特定的浏览器或设备而导致... url中的信息将无法正确传递.

The thing is, I have a few affiliate links and I'm worried that, if I write them with the & in some cases, for some reasons, because of the specific browser or device... that the info in the url wouldn't be passed correctly.

希望有人可以清除我的想法?

Hopefully someone can clear my mind?

谢谢!

推荐答案

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

HTML具有一组四个保留字符,必须将其表示为 实体.所有其他字符都可以用实体表示为 需要,但这不是强制性的.这些是用于这些的实体 四个保留字符:

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 :

  • &(&)-必需,以便浏览器不会将其误解为实体的开头.
  • &lt;(<)-必需的,因为否则浏览器可能会将其误解为标记的开头
  • &gt;(>)-必需,因为否则浏览器可能会将其误解为标记的结尾
  • &quot;()-仅在用引号将属性值交出的情况下是必需的
  • &amp; (&) - 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

See here for a full list of all HTML character entities - https://dev.w3.org/html5/html-author/charref

这篇关于我为什么要使用&amp; amp;而不是&amp ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆