Css nth-of-type problem

to ask a question, please see the code:

target5</span>
  </div>
</body>

</html>
The goal of

is to select the 2n any element with a .target class name, that is, target2, target4

if you use .target: nth-of-type (2n) , this selector indicates this is the 2n span, of the parent element with target class , and target2 is the third span, so it is not selected.

if you use .target:nth-child (2n) , this selector represents the 2n element of the parent element, with target class . Causes the sixth and eighth elements of the parent element, target3 and target5, to be selected, and the seventh element, target4, to be unselected.

is there any other way to use only css without moving html,?

Oct.28,2021

first of all, if html, only uses css, there is no solution
because the content you choose is based on the text content in the tag, and the css selector cannot match the text information in the tag
since you want to match the element whose tag content is target [2n] , why not just add a unified class name to its span tag?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4ba03-44e60.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4ba03-44e60.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?