开发者社区> 问答> 正文

:nth-child(n)选择器中的n可不可以引用到属性中?

如果是原生的CSS(不使用编译器)可不可以达到这样的效果?
或者有没有哪个属性或方法是可以使数值与n相关的?

.box:nth-child(n){
    -webkit-animation-delay:n s;
            animation-delay:n s;
}

展开
收起
a123456678 2016-05-26 17:24:29 2476 0
1 条回答
写回答
取消 提交回答
  • 在原生的基础上,部分 Firefox 浏览器可以实现 CSS 变量

    element {
      --animation-delay: 3s;
    } 
    
    .box:nth-child(n) {
    -webkit-animation-delay: var(--animation-delay);
            animation-delay: var(--animation-delay);
    }
    2019-07-17 19:16:38
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载