登入/註冊 body { font-family: sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #f0f2f5; margin: 0; } .container { background-color: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); width: 100%; max-width: 400px; } .toggle-switch { display: flex; justify-content: center; align-items: center; margin-bottom: 30px; gap: 10px; } .toggle-switch label { font-size: 1.1em; color: #555; cursor: pointer; } .toggle-switch input[type="checkbox"] { display: none; /* Hide the default checkbox */ } .toggle-switch .slider { width: 60px; height: 30px; background-color: #ccc; border-radius: 15px; position: relative; cursor: pointer; transition: background-color 0.3s; } .toggle-switch .slider:before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; background-color: white; top: 2px; left: 2px; transition: transform 0.3s, background-color 0.3s; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); } .toggle-switch input[type="checkbox"]:checked + .slider { background-color: #1a73e8; /* Blue color when checked */ } .toggle-switch input[type="checkbox"]:checked + .slider:before { transform: translateX(30px); } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 8px; font-weight: bold; color: #333; } .form-group label .required-star { color: #f44336; /* Red color for asterisk */ margin-left: 4px; } .form-group input[type="text"], .form-group input[type="password"] { width: calc(100% - 20px); /* Adjust for padding */ padding: 12px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 1em; background-color: #e8f0fe; /* Light blue background as in image */ box-sizing: border-box; /* Include padding in element's total width and height */ } .form-group input[type="text"]:focus, .form-group input[type="password"]:focus { border-color: #1a73e8; outline: none; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2); } 登入 註冊 帳號 * 密碼 * // Optional: Add JavaScript to handle the toggle switch document.addEventListener('DOMContentLoaded', function() { const toggleLogin = document.getElementById('toggleLogin'); const loginLabel = document.querySelector('.toggle-switch label[for="toggleLogin"]:first-of-type'); const registerLabel = document.querySelector('.toggle-switch label[for="toggleLogin"]:last-of-type'); toggleLogin.addEventListener('change', function() { if (this.checked) { // Switched to "註冊" (Register) loginLabel.style.color = '#555'; registerLabel.style.color = '#1a73e8'; // You might change form fields or submit action here console.log('Switched to Register'); } else { // Switched to "登入" (Login) loginLabel.style.color = '#1a73e8'; registerLabel.style.color = '#555'; // You might change form fields or submit action here console.log('Switched to Login'); } }); });