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 Class binding Ternary Operator</h3> <div v-bind:class="isActive ? 'active' : 'inactive'"> This is Some Paragarph </div> <button @click="isActive = !isActive">Click</button> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { isActive: true // Or false, depending on your needs }; }, }); </script> <style scoped> #app { font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; } h3 { font-size: 24px; font-weight: bold; color: #333; margin-bottom: 20px; } .active { background-color: #4CAF50; color: #fff; padding: 10px; border-radius: 5px; } .inactive { background-color: #ddd; color: #333; padding: 10px; border-radius: 5px; } button { background-color: #4CAF50; color: #fff; border: none; padding: 10px 20px; border-radius: 5px; font-size: 16px; cursor: pointer; margin-top: 20px; } button:hover { background-color: #3e8e41; } </style> </body> </html>