screen_rotation
Copied to Clipboard
<html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app" class="my-app"> <h3>Vue Js Subtract Two Number Example</h3> <p class="number-paragraph">First Number: {{ num1 }}</p> <p class="number-paragraph">Second Number: {{ num2 }}</p> <input class="input-field" v-model="num1" type="number" placeholder="Enter the first number"> <input class="input-field" v-model="num2" type="number" placeholder="Enter the second number"> <p class="result-paragraph">Result: {{ result }}</p> <button class="subtract-button" @click="subtract">Subtract</button> </div> <script type="module"> const app = new Vue({ el: "#app", data: { num1: 12, num2: 3, result: 0 }, methods: { subtract: function () { this.result = this.num1 - this.num2; } } }) </script> <style scoped> /* Style the outer container */ .my-app { font-family: Arial, sans-serif; text-align: center; padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); width: 300px; margin: 0 auto; } /* Style the number paragraphs */ .number-paragraph { font-size: 18px; color: #333; margin: 10px 0; } /* Style the result paragraph */ .result-paragraph { font-size: 20px; font-weight: bold; color: #0066cc; margin: 10px 0; } /* Style the input fields */ .input-field { width: 100%; padding: 8px; margin: 8px 0; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; } /* Style the subtract button */ .subtract-button { background-color: #0066cc; color: #fff; border: none; border-radius: 5px; padding: 10px 20px; font-size: 18px; cursor: pointer; transition: background-color 0.3s ease; } .subtract-button:hover { background-color: #0055aa; } </style> </body> </html>