Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
  <title>v-bind background-color</title>
  <style>
    #app > div {
      width: 200px;
      padding: 20px;
      border: dashed black 1px;
    }
    .myClass {
      background-color: lightcoral;
    }
  </style>
</head>
<body>
<h1>Example</h1>
<p>'v-bind' is used to assign class with true/false.</p>
<p>The browser set the 'myClass' class on the div tag when set to 'true'.</p>
<div id="app">
  <div v-bind:class="{ myClass: true }">
    Importance visualized by background color
  </div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
  const app = Vue.createApp({
   // The Vue instance is empty
  })
  app.mount('#app')
</script>
</body>
</html>