There are many div elements with the same class= "demo" class name on the page. How to use css to select the first div? whose class is demo

there are many div elements with the same class= "demo" class name in the page, but not all of them are in the same parent element. How to use css to select the first div? whose class is demo

Feb.28,2021

what a pure css selector cannot do with different parent elements, change the implementation idea, such as changing the structure or using js.


$('.demo'). Eq (0); so not the first


I don't know whether you use jq or native
var demon_01 = $('.demon'). Eq (0)
var demon_01 = document.querySelectorAll ('.swiper-slide') [0]


people use css a bunch of jQuery disdain->


.test:nth-of-type(N) {
  //  N  div
}
.test:last-child {
  //  div
}
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-1b356ec-2bf87.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-1b356ec-2bf87.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?