Le 2 oct. 2013 à 08:07, "Karl Snyder" <[email protected]> a écrit :
> .c2 {background-color: green;}
> .c1 {background-color: yellow;}
> </style>
> </head>
> <body>
> <div id="i1" class="c1, c2">C1 then C2</div>
> <div id="i2" class="c2, c1">C2 then C1</div>
The 'class' attribute takes a space separated list of values:
http://www.w3.org/TR/html5/dom.html#classes
(same in an html 4 document as well).
When the browser parses the html doc it sees a class 'c1,' in the first div,
ignores it for the purpose of CSS styling (there is no such class in the
stylesheet, and applies the class 'c2'. Same reasoning applies for the second
div.
The comma is not valid in a class name in a CSS document.
http://www.w3.org/TR/CSS21/syndata.html
(particularly 4.1.3)
Philippe
--
Philippe Wittenbergh
http://l-c-n.com
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/