简体   繁体   English

使用HTML特殊字符代码与直接粘贴特殊代码

[英]Using HTML special characters code vs pasting the special codes directly

Which is considered a better practice and why in terms of what does it effect: 哪种方法被认为是更好的做法,以及为什么会产生什么影响:

To use special characters HTML codes in a webpage for example © 在网页中使用特殊字符HTML代码,例如© for copyright or to use Character Map and copy paste the symbol in the page directly. 以获得版权或使用“ Character Map并复制,然后将符号直接粘贴到页面中。

To be more specific under which circumstances is it NOT recommended to use html literals? 更具体地说,在哪种情况下建议使用html文字?

Literal characters: 文字字符:

  • Use fewer bytes 使用更少的字节
  • Are generally easier to read in source code 通常更容易在源代码中阅读
  • Can be easier to type if you know how to produce them on your keyboard 如果您知道如何在键盘上制作它们,则键入起来会更容易

Entities: 实体:

  • Can be less ambiguous in source code 可以在源代码中减少歧义
  • Can be typed on any keyboard 可以在任何键盘上输入
  • Work even if your somehow manage to screw up the encoding of the document 即使您设法以某种方式搞乱了文档的编码,也可以工作

Which is "better" depends on the particular circumstances. 哪个“更好”取决于具体情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM