Skip to content

Commit 6e6fd62

Browse files
dletoreybsmth
andauthored
27180 css nesting (#147)
* added creating complex selectors with nesting * added comment to show how the browser parses the nesting * Update learn/selectors/nesting.html Co-authored-by: Brian Thomas Smith <brian@smith.berlin> * Update learn/selectors/nesting.html Co-authored-by: Brian Thomas Smith <brian@smith.berlin> * correctly indented the nesting.html example * removed the empty style tags --------- Co-authored-by: Brian Thomas Smith <brian@smith.berlin>
1 parent acc8830 commit 6e6fd62

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

learn/selectors/nesting.html

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html lang="en-us">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width" />
6+
<title>Selectors: General Sibling Combinator </title>
7+
<link rel="stylesheet" href="../styles.css">
8+
<style class="editable">
9+
h1 {
10+
& ~ p { /* this is parsed by the browser as h1 ~ p */
11+
font-weight: bold;
12+
background-color: #333;
13+
color: #fff;
14+
padding: .5em;
15+
}
16+
}
17+
</style>
18+
</head>
19+
20+
<body>
21+
<section class="preview">
22+
<article>
23+
<h1>A heading</h1>
24+
<p>I am a paragraph.</p>
25+
<div>I am a div</div>
26+
<p>I am another paragraph.</p>
27+
</article>
28+
</section>
29+
30+
<textarea class="playable playable-css" style="height: 150px;">
31+
h1 {
32+
& ~ p { /* this is parsed by the browser as h1 ~ p */
33+
font-weight: bold;
34+
background-color: #333;
35+
color: #fff;
36+
padding: .5em;
37+
}
38+
}
39+
</textarea>
40+
41+
<textarea class="playable playable-html" style="height: 130px;">
42+
<article>
43+
<h1>A heading</h1>
44+
<p>I am a paragraph.</p>
45+
<div>I am a div</div>
46+
<p>I am another paragraph.</p>
47+
</article>
48+
</textarea>
49+
50+
<div class="playable-buttons">
51+
<input id="reset" type="button" value="Reset">
52+
</div>
53+
</body>
54+
<script src="../playable.js"></script>
55+
56+
</html>

0 commit comments

Comments
 (0)