On Feb 26, 2010, at 11:26 AM, MEM wrote:
> Hello all,
>
> Given the following CSS:
>
> body {
> color:blue;
> }
>
> #ola {
> color:black;
> }
>
> div {
> color:red;
> }
>
> p#ola.verde {
> color:green;
> }
>
> p.verde
> {
> color:gray;
> }
>
> div#ola p.verde {
>
> color:purple;
> }
>
> And the following XHTML excerpt:
>
> <body>
>
> <div id=“ola”>
>
> <p class=“verde”>ola</p>
>
> </div>
>
> </body>
>
> I was expecting to see a *purple* string "ola" on the viewport.
> Instead, I see a *red* one.
>
>
> But isn't the specification of the declaration div#ola p.verde higher then
> the type selector div declaration ? What about the p.verde one, isn't higher
> as well as the div alone?
>
> Obviously I'm missing something, but I'm unable to see what.
>
> Can I please ask, what I'm not getting?
In the html the above, the quotes around the id= and class= are wrong. Those
should plain quotes like this
id="ola"
class="verde"
Basically, your class and id attributes are ignored by the browser, and only
div {color:red} is applied.
(you did understand the cascade right :-).
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/