I am currently preparing myself for a regional championship in web development for high-school students. Preparation tasks are one the championships website to solve. I have the following HTML code:
<h2>Task 5</h2>
<article id="task-5">
<div class="marble"></div>
<div class="marble"></div>
<section>
<div class="marble" data-target></div>
<div class="marble" data-target></div>
<section>
<div class="marble"></div>
<div class="marble"></div>
</section>
</section>
</article>
My goal is to select the divs with the marble class marked with data-target, but under following requirements:
- I am not allowed to use these CSS pseudo-classes or CSS selectors:
:nth-child:nth-last-child:nth-of-type:nth-last-of-type[data-target]- nor any use of
+or~
- Only one selector is allowed.
I have tried the following selector, but it still selects the third div (the one not marked with data-target):
#task-5 section > div:not(:last-child):not(:is(:first-child:is(:last-child)))
Can you please help me. Thank you very much