Features
Clean, Minimalist Design:
- Simple white card with subtle shadow
- Rounded corners (8px for inputs, 12px for container)
- Modern font (Inter) with proper hierarchy
- Adequate spacing and padding
Responsive Layout:
- Works on mobile and desktop
- Adjusts padding for smaller screens
Form Validation:
- Checks for empty fields
- Validates email format
- Ensures password is at least 6 characters
- Error messages appear below each field in red
User Experience:
- Clear focus states for inputs
- Hover effect on button
- Helpful placeholder text
- Immediate feedback on errors
No Frameworks:
- Pure HTML, CSS, and vanilla JavaScript
- No Bootstrap or other libraries
The design follows modern web standards with a focus on usability and aesthetics. The form is centered on the page with a clean, uncluttered appearance.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', sans-serif;
}
body {
background-color: #f8fafc;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
}
.signin-container {
background-color: white;
width: 100%;
max-width: 400px;
padding: 40px;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
}
.signin-header {
margin-bottom: 32px;
text-align: center;
}
.signin-header h1 {
font-size: 24px;
font-weight: 500;
color: #1e293b;
margin-bottom: 8px;
}
.signin-header p {
color: #64748b;
font-size: 14px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: #1e293b;
font-weight: 500;
}
.form-group input {
width: 100%;
padding: 12px;
border: 1px solid #e2e8f0;
border-radius: 8px;
font-size: 14px;
transition: border-color 0.2s;
background-color: #f8fafc;
}
.form-group input:focus {
outline: none;
border-color: #94a3b8;
background-color: white;
}
.error-message {
color: #dc2626;
font-size: 12px;
margin-top: 6px;
display: none;
}
.signin-button {
width: 100%;
padding: 12px;
background-color: #2563eb;
color: white;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.2s;
margin-top: 8px;
}
.signin-button:hover {
background-color: #1d4ed8;
}
@media (max-width: 480px) {
.signin-container {
padding: 30px 20px;
}
}
document.getElementById('signinForm').addEventListener('submit', function(e) {
e.preventDefault();
// Reset error messages
document.getElementById('emailError').style.display = 'none';
document.getElementById('passwordError').style.display = 'none';
// Get form values
const email = document.getElementById('email').value.trim();
const password = document.getElementById('password').value.trim();
// Validate email
let isValid = true;
if (!email) {
document.getElementById('emailError').textContent = 'Email is required';
document.getElementById('emailError').style.display = 'block';
isValid = false;
} else if (!isValidEmail(email)) {
document.getElementById('emailError').textContent = 'Please enter a valid email address';
document.getElementById('emailError').style.display = 'block';
isValid = false;
}
// Validate password
if (!password) {
document.getElementById('passwordError').textContent = 'Password is required';
document.getElementById('passwordError').style.display = 'block';
isValid = false;
} else if (password.length < 6) {
document.getElementById('passwordError').textContent = 'Password must be at least 6 characters';
document.getElementById('passwordError').style.display = 'block';
isValid = false;
}
// If form is valid, submit it
if (isValid) {
// In a real application, you would submit the form to a server here
alert('Sign in successful!');
// this.submit();
}
});
function isValidEmail(email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
}
إرسال تعليق
Thank you
Learning robo team