Timeline for How to assign multiple classes to an HTML container?
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 24, 2021 at 1:36 | comment | added | Basil Bourque |
Update: In the current HTML5 spec, as of 2021, a class is known as one of many attributes. Class names are assigned as a set of "space-separated tokens”. The class names are separated by “ASCII whitespace” which is defined as: U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE.
|
|
S Jun 18, 2019 at 15:36 | history | suggested | ProgramGamer | CC BY-SA 4.0 |
The "just google it" part seemed a bit unfriendly, so I looked for an article on css inheritance and linked that instead.
|
Jun 18, 2019 at 12:58 | review | Suggested edits | |||
S Jun 18, 2019 at 15:36 | |||||
Jan 13, 2014 at 16:50 | comment | added | Ulrich Schwarz |
@JonathanHenson: According to CSS 2.1 specs, "if two declarations have the same weight, origin and specificity, the latter specified wins. Declarations in imported style sheets are considered to be before any declarations in the style sheet itself." So it is CSS declaration order. The names in the class attribute have no specified order, since .foo is syntactic sugar for [class ~= foo] ref, "foo is a word in the class attribute".
|
|
Jan 13, 2014 at 15:22 | comment | added | Jonathan Henson | @UlrichSchwarz the later listed CSS class (what I was hoping for when I tested this), or later in all of the CSS files? Because the former most certainly does not work in the browsers I tested in, while I have tested the latter hypothesis. | |
Jan 10, 2014 at 12:24 | comment | added | Ulrich Schwarz | @JonathanHenson: no, it's not. In case of tied specificity, the rule that occurs later in the CSS wins. | |
Jan 3, 2014 at 16:24 | comment | added | Jonathan Henson | @EternallyCurious The attributes are aggregated by the browser, so this behavior will be non-deterministic. | |
Jan 1, 2014 at 15:22 | comment | added | EternallyCurious | How should a browser be expected to react if an element is assigned to multiple classes that set different values for the same attributes. Is there some order of precedence for that? | |
S Jan 21, 2013 at 11:36 | history | suggested | Michel de Ruiter | CC BY-SA 3.0 |
layout fix for readability
|
Jan 21, 2013 at 11:31 | review | Suggested edits | |||
S Jan 21, 2013 at 11:36 | |||||
Jan 4, 2012 at 4:56 | history | answered | Jonathan Henson | CC BY-SA 3.0 |