如圖,如果像選擇類名為 class="exerciseInfo" 中的第一個和最后一個div,做法如下:
選擇第一個類名: .exerciseInfo: nth-of-type(1) { ... };
選擇最后一個類名: .exerciseInfo: last-child { ... };
選擇其中一個指定的類名:.exerciseInfo: nth-of-type(x) { ... };
-------------------------注:不要使用nth-child(x)來選擇,無效!-------------------------------
原文:https://blog.csdn.net/hh1197787867/article/details/82182069