A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Class: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
m (categorize)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
There are many misapprehensions (citations to follow) abound about the purpose of the class attribute, which is often referred to, plural, as "CSS classes".
Misapprehensions (citations to follow) abound about the purpose of the class attribute, which is often referred to, plural, as "CSS classes".


The wording in the spec should be changed to more clearly indicate the semantic nature of the class attribute, when used properly, and indicate the validuty of its use in this way.
The wording in the spec should be changed to more clearly indicate the semantic nature of the class attribute, when used properly, and indicate the validity of its use in this way.


== Current wording ==
== Current wording ==
<blockquote>
 
From: http://www.w3.org/TR/html5/elements.html#classes
 
<blockquote cite="http://www.w3.org/TR/html5/elements.html#classes">
<p>Every HTML element may have a class attribute specified.</p>
<p>Every HTML element may have a class attribute specified.</p>


Line 18: Line 21:
== Suggested wording==
== Suggested wording==


Please add and sign suggestions, so that a composite may be produced at later date
Please add and sign suggestions, so that a composite may be produced at later date. Emboldening may be used to identify changes, and will not be conveyed to the final version.


* ...may be used for labelling, styling or indicating meaning" [[User:Pigsonthewing|Pigsonthewing]] 15:49, 11 August 2010 (UTC)
*replace the final paragraph with...
* ...may be used for labelling, styling or indicating semantics" [[User:Pigsonthewing|Pigsonthewing]] 15:51, 11 August 2010 (UTC)
**There are no additional restrictions on the tokens authors can use in the class attribute, but authors are encouraged to use values that describe the '''semantic''' nature of the content, rather than values that describe the desired presentation of the content. [[User:Pigsonthewing|Pigsonthewing]] 16:00, 11 August 2010 (UTC)
* ...although classes allow content to be styled, they should be named to convey semantic meaning" [[User:Pigsonthewing|Pigsonthewing]] 15:52, 11 August 2010 (UTC)


==Prior discussion ==
==Prior discussion ==
* http://microformats.org/2005/10/19/more-than-styling
* [http://tantek.com/log/2002/12.html#L20021216 A Touch Of Class]
* [http://tantek.com/log/2004/07.html#classmeaningnotshow Class For Meaning Not For Show]
* [http://www.meyerweb.com/eric/thoughts/2004/07/18/competent-classing Competant Classing], by Eric Meyer for discussion of choosing class names in (X)HTML
* [http://www.microformats.org/blog/2005/10/19/more-than-styling/ Class attributes are about more than styling] - Ryan King dispells common misconceptions about the ''HTML'' class attribute.


== Bug ==
== Bug ==
* [http://www.w3.org/Bugs/Public/show_bug.cgi?id=10346 W3C bug 10346]
* [http://www.w3.org/Bugs/Public/show_bug.cgi?id=10346 W3C bug 10346]
[[Category:Proposals]]

Latest revision as of 12:23, 26 January 2011

Misapprehensions (citations to follow) abound about the purpose of the class attribute, which is often referred to, plural, as "CSS classes".

The wording in the spec should be changed to more clearly indicate the semantic nature of the class attribute, when used properly, and indicate the validity of its use in this way.

Current wording

From: http://www.w3.org/TR/html5/elements.html#classes

Every HTML element may have a class attribute specified.

The attribute, if specified, must have a value that is a set of space-separated tokens representing the various classes that the element belongs to.

The classes that an HTML element has assigned to it consists of all the classes returned when the value of the class attribute is split on spaces. (Duplicates are ignored.)

Assigning classes to an element affects class matching in selectors in CSS, the getElementsByClassName() method in the DOM, and other such features.

There are no additional restrictions on the tokens authors can use in the class attribute, but authors are encouraged to use values that describe the nature of the content, rather than values that describe the desired presentation of the content.

Suggested wording

Please add and sign suggestions, so that a composite may be produced at later date. Emboldening may be used to identify changes, and will not be conveyed to the final version.

  • replace the final paragraph with...
    • There are no additional restrictions on the tokens authors can use in the class attribute, but authors are encouraged to use values that describe the semantic nature of the content, rather than values that describe the desired presentation of the content. Pigsonthewing 16:00, 11 August 2010 (UTC)

Prior discussion

Bug