samedi 25 juin 2016

Scoped CSS using @import in style attribute?

This W3C draft (from 2002) mentions an intriguing way of having scoped CSS (apparently in HTML 4) using the style attribute and the @import statement in CSS. More precisely, they give the following example (example 4, section 2)

  1. Importing a style sheet to apply as a scoped style sheet:
<div class="navigation">
          style="@import url(navigationstyles.css);">...</div>

This document defines ... and scoped style sheets (the use of >@import which apples the referenced style sheet to the subdocument >consisting of the element and its children with the element as the root, >example 4).

Now, the problem is: it doesn't work (even after removing the obvious syntax error). Using the @import statement in the style attribute has absolutely no effect (in recent versions of Safari and Firefox).

So my question is: did the authors of this draft just make a mistake, or is this example correct and I'm just missing something?

Aucun commentaire:

Enregistrer un commentaire