00005.【CSS】背景颜色

 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

<template>
  <!--  背景色扩展到元素的内容和内边距下面-->
  <div class="box">
    <h2>Background Colors</h2>
    <p>Try changing the background <span>colors</span></p>
  </div>
</template>

<script setup>

</script>

<style scoped>
.box {
  background-color: #567895;
}

h2 {
  background-color: black;
  color: white;
}

span {
  background-color: rgba(255, 255, 255, .5);
}
</style>