Css – Sifr3 – Is it possible to override CSS styling with parent selector

csssifr

I would like to override setting that already defined with selecting
parent selector but I don't know how.
Say, there are 2 pages on a website like the following…

-Home page-
<body><h1 class="sifr">Home</h1></body>

-About page-
<body class="about"><h1 class="sifr">About</h1></body>

then, I have these in sirf-config.js…

sIFR.replace(fontname, {
selector: 'h1.sifr',
css: '.sIFR-root { color: #666666; font-size:29px; }'
});

sIFR.replace(fontname, {
selector: 'body.about h1.sifr',
css: '.sIFR-root { color: #FFFFFF; font-size:29px; }'
});

but it doesn't work…

If anybody help me I would appreciate.

Best Answer

Run the replacements for body.about h1.sifr before h1.sifr. sIFR doesn't calculate specificity but executes the replacements in-order. Replacing h1.sifr replaces all such elements, so body.about h1.sifr only finds elements that have already been replaced.