Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

class

这篇翻译不完整。请帮忙从英语翻译这篇文章

全局属性class,是一个以空格分隔的class属性列表。可允许CSS和Javascript对Class属性进行选择,通过class选择器或者类似DOM方法的方程来选取文档中某一类特定的元素。
document.getElementsByClassName.

Though the specification doesn't put requirements on the name of classes, web developers are encouraged to use names that describe the semantic purpose of the element, rather to the presentation of the element (e.g., attribute to describe an attribute rather than italics, although an element of this class may be presented by italics). Semantic names remain logical even if the presentation of the page changes.

详细说明

具体条目 标准 备注
WHATWG HTML Living Standard
class
Living Standard No change from latest snapshot, HTML5.1
HTML5.1
class
Working Draft Snapshot of WHATWG HTML Living Standard, no change from HTML5
HTML5
class
Recommendation Snapshot of  WHATWG HTML Living Standard. From HTML 4.01 Specification, class is now a true global attribute.
HTML 4.01 Specification
class
Recommendation Supported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.

浏览器兼容

特性 Chrome Firefox (Gecko) Internet Explorer Opera Safari
基础支持 (Yes) (Yes) [1] (Yes) (Yes) (Yes)
特性 Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
基础支持 (Yes) (Yes) (Yes) [1] (Yes) (Yes) (Yes)

[1] 在Firefox 32及往后的版本中,class才成为真正的全局属性。

另见

文档标签和贡献者

标签: 
 此页面的贡献者: Feihei
 最后编辑者: Feihei,