Saturday, May 18, 2024
HomeCSShtml - How you can choose first and final youngsters of a...

html – How you can choose first and final youngsters of a component with out :nth pseudo-classes


I’m presently making ready myself for a regional championship in net improvement for high-school college students. Preparation duties are one the championships web site to resolve. I’ve the next HTML code:

<h2>Job 6</h2>
  <article id="task-6">
    <div class="marble" data-target></div>
    <part class="first">
      <div class="marble" data-target></div>
      <div class="marble"></div>
      <div class="marble" data-target></div>
    </part>
    <div class="marble"></div>
    <part class="final">
      <div class="marble" data-target></div>
      <div class="marble"></div>
      <div class="marble" data-target></div>
    </part>
    <div class="marble" data-target></div>
  </article>

My purpose is to pick out the divs with the marble class marked with data-target, however below following necessities:

I’ve tried the next selector, nonetheless it solely selects the divs inside the part parts.

#task-6 part div:not(:not(:first-child):not(:last-child))

Are you able to please assist me. Thanks very a lot.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments