Html 做什么 和 > 代表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5068951/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 06:51:14  来源:igfitidea点击:

What do < and > stand for?

htmlterminologyhtml-entitieshtml-escape-characters

提问by Michiel Pater

I know that the entities &lt;and &gt;are used for <and >, but I am curious what these names stand for.

我知道实体&lt;and&gt;用于<and >,但我很好奇这些名称代表什么。

Does &lt;stand for something like "Left tag" or is it just a code?

是否&lt;代表类似“左边的标记”或者是它只是一个代码?

回答by biscuitstack

  • &lt;stands for the less-than sign( < )
  • &gt;stands for the greater-than sign( > )
  • &le;stands for the less-than or equals sign ( ≤ )
  • &ge;stands for the greater-than or equals sign ( ≥ )
  • &lt;代表小于号( < )
  • &gt;代表大于号( > )
  • &le;代表小于或等于号 ( ≤ )
  • &ge;代表大于或等于号 ( ≥ )

回答by James Goodwin

&lt;Less than: <

&lt;少于: <

&gt;Greater than: >

&gt;比...更棒: >

回答by meder omuraliev

They're used to explicitly define less than and greater than symbols. If one wanted to type out <html>and not have it be a tag in the HTML, one would use them. An alternate way is to wrap the <code>element around code to not run into that.

它们用于显式定义小于和大于符号。如果想要输入<html>而不是将其作为 HTML 中的标签,则可以使用它们。另一种方法是将<code>元素包装在代码周围,以免遇到这种情况。

They can also be used to present mathematical operators.

它们还可用于表示数学运算符。

<!ENTITY lt      CDATA "&#60;"   -- less-than sign, U+003C ISOnum -->
<!ENTITY gt      CDATA "&#62;"   -- greater-than sign, U+003E ISOnum -->

http://www.w3.org/TR/html4/sgml/entities.html

http://www.w3.org/TR/html4/sgml/entities.html

回答by Mārti?? Briedis

&lt; ==  lesser-than == <
&gt; == greater-than == >

回答by Greg Treleaven

&lt= less than <, &gt= greater than >

&lt= 小于<, &gt= 大于>

回答by BKSpurgeon

Others have noted the correct answer, but have not clearly explained the all-important reason:

其他人已经注意到正确答案,但没有清楚地解释最重要的原因:

  • whydo we need this?
  • 为什么我们需要这个?

What do < and > stand for?

< 和 > 代表什么?

  • &lt;stands for the <sign. Just remember: lt == less than
  • &gt;stands for the >Just remember: gt == greater than
  • &lt;代表 <标志。请记住:LT ==ESS牛逼
  • &gt;代表的是>要记住:GT ==reater牛逼

Why can't we simply use the <and >characters in HTML?

为什么我们不能简单地在 HTML 中使用<>字符?

  • This is because the >and <characters are ‘reserved' characters in HTML.
  • HTML is a mark up language: The <and >are used to denote the starting and ending of different attributes: e.g. <h1>and not for the displaying of the greater than or less than symbols. But what if you wanted to actually display those symbols? You would simply use &lt;and &gt;and the browser will know exactly how to display it.
  • 这是因为><字符是 HTML 中的“保留”字符。
  • HTML 是一种标记语言:<>用于表示不同属性的开始和结束:例如,<h1>和 不用于显示大于或小于符号。但是,如果您想实际显示这些符号怎么办?您只需使用&lt;and &gt;,浏览器就会确切地知道如何显示它。

回答by Kathir

&gt; and &lt;is a character entity reference for the >and <character in HTML.

&gt; and &lt;是HTML 中><字符的字符实体引用。

It is not possible to use the less than (<) or greater than (>) signs in your file, because the browser will mix them with tags.

不能在文件中使用小于 (<) 或大于 (>) 符号,因为浏览器会将它们与标签混合。

for these difficulties you can use entity names(&gt;) and entity numbers(&#60;).

对于这些困难,您可以使用实体名称(&gt;)和实体编号(&#60;)。

回答by tejasgupta

&lt;stands for lesser than (<) symboland, the &gt;sign stands for greater than (>) symbol.

&lt;代表lesser than (<) symbol和,&gt;符号代表greater than (>) symbol

For more information on HTML Entities, visit this link:

有关 HTML 实体的更多信息,请访问此链接:

https://www.w3schools.com/HTML/html_entities.asp

https://www.w3schools.com/HTML/html_entities.asp

回答by shilovk

in rails:

导轨中

&lt=    this is    <=
=&gt    this is    =>

回答by zamoldar

In HTML, the less-than sign is used at the beginning of tags. if you use this bracket "<test1>" in content, your bracket content will be unvisible, html renderer is assuming it as a html tag, changing chars with it's ASCI numbers prevents the issue.

在 HTML 中,小于号用于标签的开头。如果您<test1>在内容中使用此括号“ ”,您的括号内容将不可见,html 渲染器将其假定为 html 标签,使用它的 ASCI 数字更改字符可以防止出现此问题。

with html friendly name:

带有 html 友好名称:

  &lt;test1&gt; 

or with asci number:

或 asci 编号:

 &#60;test1&#62;

or comple asci:

或完整的asci:

&#60;&#116;&#101;&#115;&#116;&#49;&#62;

result: <test1>

结果:<test1>

asci referance: https://www.w3schools.com/charsets/ref_html_ascii.asp

asci 参考:https://www.w3schools.com/charsets/ref_html_ascii.asp