html - 使用 Less 动态增加 z-index

标签 html css loops less z-index

我试图在不使用任何 JavaScript/jQuery 的情况下增加类 .box 元素的 z-index,因为它们在浏览器中动态显示。我试过使用原生 css counter-increment,但这只对在屏幕上显示数字有用:

    .container {
        counter-reset: indexvalue;
    }

    .box {
        position: relative;
        counter-increment: indexvalue;
        z-index: counter(indexvalue);
    }

那么使用 Less,请问如何在每个 .box 出现在屏幕上时增加它们的 z-index?

非常感谢

最佳答案

这是不可能的。

Less 编译器只在“编译时”创建一次 CSS 文件。

您尝试完成的将是“运行时”。

关于html - 使用 Less 动态增加 z-index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27302008/

相关文章:

javascript - 换行不包含在单词中的字符

html - 如何在这个响应式、可翻转的圆圈中垂直居中图像?

Java - 为什么我的素数程序不打印最后一个数字?

c - 循环中的冗余代码

html - Bootstrap 固定导航栏、粘性页脚、动态缩放内容

jquery - 将 jquery 添加到 CSS 菜单

html - 左侧菜单的问题

html - 具有行高的菜单使菜单在缩放时消失

CSS 和 Internet Explorer 不兼容

php - 我的 PHP MySQL while 循环不返回结果