Want to share your CSS expertise with others? Apply to the MDN Fellowship by April 1! http://mzl.la/MDNFellowship

mozilla

Compare Revisions

:scope

Change Revisions

Revision 449821:

Revision 449821 by teoli on

Revision 449827:

Revision 449827 by teoli on

Title:
:scope
:scope
Slug:
Web/CSS/:scope
Web/CSS/:scope
Content:

Revision 449821
Revision 449827
n16    <h2>n16    <h2 id="Syntax">
nn22    <h2>
23      Example
24    </h2>
25    <pre class="brush:html;highlight:7">
26&lt;article&gt;
27  The element selected by :scope has a lime background if your br
 >owser supports scoped stylesheet.
28  &lt;section&gt; 
29    &lt;p&gt;Outside scope.&lt;/p&gt;
30  &lt;/section
31  &lt;section&gt;
32    &lt;style scoped&gt;
33      :scope { background-color: lime; }
34    &lt;/style&gt;
35    &lt;p&gt;Inside scope.&lt;/p&gt;
36  &lt;/section&gt;
37&lt;section&gt; 
38    &lt;p&gt;Outside scope.&lt;/p&gt;
39  &lt;/section
40&lt;/article&gt;
41</pre>
42    <h3 id="Live_sample">
43      Live result
44    </h3>
45    <div>
46      {{ EmbedLiveSample('Example', '100%', '200') }}
47    </div>
t154    <h2>t180    <h2 id="See_also">

Back to History