2

我有 .aClass

.aClass {
 width: 20px;
 height: 20px;
}

在 .anotherClass 中,我想根据 .aClass 中的宽度属性值计算宽度值。

.anotherClass {
 width: .aClass.width
}

上面的例子不起作用。

我在较少的文档中找不到任何东西。有没有办法做到这一点?

4

1 回答 1

1

在代码顶部声明变量

@width: 10px

然后,

.aClass {
 width: @width;
 height: 20px;
}

.anotherClass {
 width: @width;
}
于 2012-08-17T12:02:37.083 回答