基本上,标题就是这一切。
div {
border-radius: 4px;
background-image: url(IMAGE1.PNG), url(IMAGE2.PNG);
box-shadow: 0 0 10px rgba(0,0,0,0.75), inset 1px 1px 2px #fff, inset -1px -1px 1px #777;
}
基本上,我希望image1将默认属性保持为典型背景,但我希望将image2设置为等同于background-size: cover;
答案 0 :(得分:4)
background-size
也接受多个值。
background-size: auto, cover;
var pattern = Trianglify({
height: 300,
width: 300,
cell_size: 40,
});
var div = document.getElementsByTagName('div')[0];
div.style.backgroundImage = "url('https://i.stack.imgur.com/955qe.png'), url('" + pattern.png() + "')";

div {
border-radius: 4px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.75), inset 1px 1px 2px white, inset -1px -1px 1px #777;
background-position: center;
background-repeat: no-repeat;
background-size: auto, cover;
height: 140px;
width: 300px;
}

<script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/0.2.0/trianglify.min.js"></script>
<div></div>
&#13;