If I wanted to customize the background of the initial 2 <div>
elements within the "main" <div>
in the following HTML snippet.
SOURCE CODE
<div class="main">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
Is this the most effective approach to achieve this?
CSS
.main div:nth-of-type(1),
.main div:nth-of-type(2) {
background: #000;
}