【问题标题】:Increment z-index dynamically with Less使用 Less 动态增加 z-index
【发布时间】:2014-12-04 19:08:06
【问题描述】:

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

    .container {
        counter-reset: indexvalue;
    }

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

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

非常感谢

【问题讨论】:

  • 这是不可能的,因为 Less 不知道您将在其中使用生成的 CSS 的 HTML。

标签: html css loops less z-index


【解决方案1】:

这是不可能的。

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

您尝试完成的工作将在“运行时”中完成。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多