1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<template>
<!-- 默认情况下,大图不会压缩以适应方框,而小图则是平铺以填充方框 -->
<!-- 如果同时指定了背景颜色和背景图像,则背景图像显示在背景颜色之上 -->
<div class="wrapper">
<div class="box a"></div>
<div class="box b"></div>
</div>
</template>
<script setup>
</script>
<style scoped>
.box {
width: 100px;
height: 100px;
}
.a {
background-image: url("../assets/balloons.jpg");
background-color: #1a1a1a;
}
.b {
background-image: url("../assets/star.png");
background-color: green;
}
</style>
|