首页 > 解决方案 > 有没有办法选择每隔一个部分 - CSS中的行

问题描述

我正在尝试在每个第二个或(偶数)部分中选择 .row 类。

我只是无法理解或找到解决方案。

我试过了:(没有用)..

   .row:nth-of-type(2){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
   }
   .row:nth-child(2){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
   }
   .row:nth-of-type(even){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
   }
   .row:nth-child(even){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
   }

   .section:nth-of-type(2){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
    }
   .section:nth-child(2){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
    }
    .section:nth-of-type(even){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
    }
   .section:nth-child(even){
        flex-direction: row-reverse;
        background-color: #a5a5a536;
    }

代码

标签: csscss-selectors

解决方案


推荐阅读