我想创建一些sass变量来表示不同的z-index值,并希望使用一个已有的命名约定(如果存在)。我在寻找的东西怎么样摇摆定义root,layered,content,和glass窗格,或指向一些理论,我可以作为一个命名依据使用。
在考虑了一些工作之后,这是我们想出的(包装在Sass地图中):
$z-index: (
'satellite' : 5000,
'skyscraper' : 1000,
'tower-block' : 500,
'house' : 200,
'bungalow-chimney' : 110,
'bungalow' : 100,
'shed' : 50,
'postbox' : 10,
'curb' : 1,
'pavement' : 0,
'pothole' : -10,
'ditch' : -20,
'sewer' : -100,
'mine' : -300,
'seabed' : -1000
);
Run Code Online (Sandbox Code Playgroud)
然后像这样引用:
.foo {
z-index: map-get($z-index, 'pothole');
}
Run Code Online (Sandbox Code Playgroud)