screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <template> <button @click="openModal">Open Modal</button> <div v-if="showModal" class="modal"> <div class="modal-content"> <span class="close" @click="closeModal">×</span> <h2>Vue Js Modal Close Button</h2> <p>Modal content goes here.</p> </div> </div> </template> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { showModal: false }; }, methods: { openModal() { this.showModal = true; }, closeModal() { this.showModal = false; } } }); </script> <style scoped> .modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; } .modal-content { background-color: #fff; padding: 20px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); width: 400px; display: flex; flex-direction: column; position: relative; } .close { color: #333333; position: absolute; top: 10px; right: 10px; cursor: pointer; font-size: 28px; font-weight: bold; transition: color 0.3s ease; } .close:hover, .close:focus { color: #FF0000; /* Bright red color on hover and focus */ text-decoration: none; } </style> </body> </html>