<div class="container">
<h2>This is a heading</h2>
<p>This paragraph comes after the heading.</p>
<p>This is the second paragraph.</p>
<h2>Another heading</h2>
<p>This paragraph comes after the heading.</p>
<ul class="list">
<li>One</li>
<li>Two
<ul>
<li>2.1</li>
<li>2.2</li>
</ul>
</li>
<li>Three</li>
</ul>
</div>
/** Targets any p elemtent that is adjacent to an h2**/
h2 + p {
color: red;
}
/** Targets ul with the class of list and it's direct child **/
ul[class="list"] > li {
border-bottom: 1px solid grey;
list-style-type: none;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.