gpt4 book ai didi

html - 两个不同尺寸的DIV背景

转载 作者:行者123 更新时间:2023-11-28 10:44:33 25 4
gpt4 key购买 nike

基本上,标题说明了一切。

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;

最佳答案

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('/image/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>

关于html - 两个不同尺寸的DIV背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29764939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com