Created
October 14, 2011 10:44
-
-
Save jakearchibald/1286795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="whatever"> | |
<style> | |
.whatever { | |
p { | |
margin: 0; | |
} | |
} | |
/* Or even better... */ | |
:root { | |
p { | |
margin: 0; | |
} | |
} | |
/* Where :root would be the style root element, rather than document root element */ | |
</style> | |
<link rel="stylesheet" href="..."> | |
<div>...More stuff...</div> | |
</div> |
cool. Since the :root
method achieves effectively the same thing as scoped
, I'd be very happy to put my vote on it (or something similar that's back-compat). thx for gisting this! -- J
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not against allowing style & link elements in the body, having style elements in the body isn't optimal though (because of the combining & minification thing).
What I've tried to show above is there's no point having a
scoped
attribute on style elements, the problem should be solved in the CSS rather than the HTML.If the scoping was handled in the CSS, I could put them in the body for landmarking and discovery, but a build script could combine all the stylesheets and put them in the head of the document.
My problem with the
scoped
attribute is it seems redundant compared to selector nesting.