w3c 关于Element属性(Attribute)的表述翻译

3.2.2 Attributes
3.2.2 属性

Elements may have associated properties, called attributes, which may have values (by default, or set by authors or scripts). Attribute/value pairs appear before the final ">" of an element's start tag. Any number of (legal) attribute value pairs, separated by spaces, may appear in an element's start tag. They may appear in any order.
Element可能会有关联的元素,我们称之为属性,他们可能具有值(可能是默认,或由开发者或脚本设置).属性/值对出现在元素的开始标签最后一个">"之前。多数(合法的)属性/值对,用空格分隔,可显示在元素的开始标签内。并且他们可以以乱序出现。

In this example, the id attribute is set for an H1 element:
在这个例子中,给H1元素设置了id属性

<H1 id="section1">
This is an identified heading thanks to the id attribute
</H1>

By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa. Authors may also use numeric character references to represent double quotes (&#34;) and single quotes (&#39;). For double quotes authors can also use the character entity reference &quot;.
默认情况下,SGML要求所有的属性值用双引号(十进制ASCII值 34)或者单引号(十进制ASCII值39)来分隔。当值被双引号括起来的时候,在值内可以包含单引号,反之亦然。开发员同样可以使用数字字符引用(NCRs)来表示双引号(&#34;)和单引号(&#39;).对于双引号,开发人员也可以使用字符尸体引用(CER)&quot;

In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them.
在某些情况下,开发人员也许要指定一个没有使用引号的属性值。此时,属性值只能包含字符(a-z 和 A-Z),数字(0-9),连字号(十进制ASCII 45)(注:半角减号),点(十进制ASCII 46),下划线(十进制ASCII 95),和冒号(十进制ASCII 58)。我们建议使用引号,即使在可能被移除的时候。

Attribute names are always case-insensitive.
属性名在任何时候都不区分大小写。

Attribute values are generally case-insensitive. The definition of each attribute in the reference manual indicates whether its value is case-insensitive.
属性值一般是不区分大小写的。每个属性的参考手册定义中有指出在什么时候,属性值是区分大小写的。

All the attributes defined by this specification are listed in the attribute index.
所有本说明的属性定义都在Attribute 索引中给出列表。

Mitchell Chu 备注:

Author在这里我翻译成了开发人员。翻译可能存在不准确的地方,仅供参考。

Monday, April 02, 2012 | 其他技术 HTML&HTML5

关于博主

  一枚成分复杂的网络IT分子,常年游弋于电子商务,属于互联网行业分类中的杂牌军。当前正在待业中...