Login Page HTML — Complete Code
<!-- Dark login card -->
<div class="auth-wrap">
<div class="auth-card">
<h1>Sign in</h1>
<p>Don't have an account?
<a href="/signup">Sign up</a></p>
<form>
<label for="email">Email</label>
<input type="email" id="email"
placeholder="you@example.com"
autocomplete="email" required>
<label for="password">Password</label>
<input type="password" id="password"
autocomplete="current-password" required>
<a href="/forgot-password">Forgot password?</a>
<button type="submit">Sign in</button>
</form>
</div>
</div>
Frequently Asked Questions
How do I create a login page in HTML?
HTML login page structure: centered auth card (max-width:420px, dark background, padding:32px, border-radius:16px), heading 'Sign in', email input (type='email', autocomplete='email'), password input (type='password', autocomplete='current-password'), 'Forgot password' link, submit button (full width). CSS: flexbox center on the viewport. Connect to any backend (Supabase, Firebase, your own API) via form submit or JS fetch.
How do I connect an HTML login form to an auth backend?
Using Supabase (free): import `createClient` from `@supabase/supabase-js`, call `supabase.auth.signInWithPassword({email, password})` on form submit. Using Firebase: `signInWithEmailAndPassword(auth, email, password)`. Using your own API: `fetch('/api/login', {method:'POST', body:JSON.stringify({email,password})})`. For all approaches, redirect on success: `window.location.href = '/dashboard'`.
What should a login page include?
Login page elements: email field (type='email', autocomplete='email'), password field with show/hide toggle (autocomplete='current-password'), 'Forgot password' link (below password field), submit button with loading state, link to sign-up page, optional social login buttons (Google, GitHub). Don't include: username field unless needed (email is easier to remember), CAPTCHA on login (use it on sign-up instead).
How do I add a 'show password' toggle to HTML?
HTML: add a button inside the password input container. JS: `const toggle = document.querySelector('.show-pw'); const input = document.querySelector('#password'); toggle.addEventListener('click', () => { input.type = input.type === 'password' ? 'text' : 'password'; toggle.textContent = input.type === 'password' ? 'Show' : 'Hide'; })`. Use an eye icon SVG instead of text for better UX. Label with aria-label='Show password' for screen readers.
What is the best free auth solution for HTML websites?
Best free auth options: Supabase (free, 50K MAU, email + OAuth) — best for new projects. Firebase Auth (free, unlimited users) — best if using Google Cloud. Auth0 (free, 7K MAU) — best for enterprise SSO requirements. For simple email-only auth with no framework: Netlify Identity (free, 1K users) — works directly with Netlify-hosted HTML sites with zero backend code.