screen_rotation
Copied to Clipboard
<html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Vue Js Dyanamic Class Binding</h3> <div :class="{ 'class-name': condition }">This text will be red if the condition is true.</div> <button @click="condition = !condition">toggle condition</button> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { condition: false } }, }); </script> <style> .class-name { color: red; font-weight: bold; background-color: yellow; padding: 10px; border: 2px solid black; } /* Styles for the container div */ #app { display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: #f7f7f7; font-family: Arial, sans-serif; } /* Styles for the heading */ h3 { margin-bottom: 20px; font-size: 24px; font-weight: bold; text-align: center; } button { margin: 10px; padding: 10px 20px; border: none; background-color: #333; color: #fff; font-size: 16px; cursor: pointer; transition: background-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); } button:hover { background-color: #66bb6a; } </style> </body> </html>