我知道可以使用 CSS 制作多个背景图层,但我可以对来自不同类的多个背景进行分层吗?假设我有 div 作为瓷砖,可以有山脉或丘陵,并且可以属于某个国家。
.mountain {
background: url("mountain.png");
}
.hill {
background: url("hill.png");
}
.bluecountry {
background: url("bluecountry.png");
}
.redcountry {
background: url("redcountry.png");
}
.greencountry {
background: url("greencountry.png");
}
将是我的CSS。但是,这不起作用;当我做类似的事情时
<div class="hill bluecountry">
它不会对背景进行分层,只会使用其中一个。有什么办法可以使这项工作?我实际上有比这更多的东西,并且必须为每种可能的组合单独编写 CSS 多个背景将是巨大的浪费时间。