screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'> </head> <body> <div id="app"> <template> <button @click="showModal = true" class="login-btn"> <i class='fa fa-sign-in'></i> Login </button> <div v-if="showModal" class="modal"> <div class="modal-content"> <i class="fa fa-times close" @click="showModal = false"></i> <h2 class="modal-title">Vue Js Modal Login Form</h2> <form @submit.prevent="submitForm"> <div class="form-group"> <i class="fa fa-envelope"></i> <input type="email" id="email" v-model="email" placeholder="Email" required> </div> <div class="form-group"> <i class="fa fa-lock"></i> <input type="password" id="password" v-model="password" placeholder="Password" required> </div> <div class="form-group remember-me"> <input type="checkbox" id="rememberMe" v-model="rememberMe"> <label for="rememberMe">Remember Me</label> </div> <button type="submit" class="submit-btn"> <i class='fa fa-sign-in'></i> Submit </button> <p class="forgot-password-link">Forgot your password? <a href="#">Click here</a></p> <p class="register-now-link">Don't have an account? <a href="#">Register Now</a></p> </form> </div> </div> </template> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { showModal: false, email: '', password: '', rememberMe: '' }; }, methods: { submitForm() { // Perform login logic here console.log('Email:', this.email); console.log('Password:', this.password); console.log('Password:', this.rememberMe); // Reset form fields this.email = ''; this.password = ''; this.rememberme = ''; // Close the modal this.showModal = false; } } }); </script> <style scoped> /* Style the button */ .login-btn { padding: 10px 20px; background-color: #3498db; color: #fff; border: none; border-radius: 4px; cursor: pointer; } .login-btn i { margin-right: 5px; font-size: 16px; /* Set the font size for icons */ } .modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.3); display: flex; justify-content: center; align-items: center; } /* Modal Content */ .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 Button */ .modal-content .close { position: absolute; top: 10px; right: 10px; cursor: pointer; background: none; border: none; padding: 0; font-size: 18px; color: #000; opacity: 0.6; transition: opacity 0.3s ease; } .modal-content .close:hover { opacity: 1; } /* Modal Title */ .modal-content .modal-title { font-size: 24px; margin-bottom: 20px; } /* Form Group */ .modal-content .form-group { position: relative; margin-bottom: 20px; } /* Icons */ .modal-content .form-group i { position: absolute; top: 50%; transform: translateY(-50%); left: 10px; color: #aaa; } /* Input Fields */ .modal-content input[type="email"], .modal-content input[type="password"] { padding: 10px 40px 10px 30px; width: 100%; border-radius: 5px; border: 1px solid #ccc; box-sizing: border-box; background-color: #f0f7f4; /* Replace #f0f7f4 with your desired background color */ outline-color: #8db9a7; /* Replace #8db9a7 with your desired outline color */ } /* Remember Me Checkbox */ .modal-content .remember-me { margin-bottom: 20px; } /* Submit Button */ .modal-content .submit-btn { padding: 10px 20px; background-color: #4caf50; color: #fff; border: none; border-radius: 5px; cursor: pointer; width: 100%; } .modal-content .submit-btn:hover { background-color: #45a049; } /* Forgot Password Link */ .modal-content .forgot-password-link, .modal-content .register-now-link { margin-top: 10px; font-size: 14px; } /* Link Styles */ .modal-content a { color: #4caf50; text-decoration: none; } /* Link Hover Styles */ .modal-content a:hover { text-decoration: underline; } </style> </body> </html>