How to Create a Simple Login Page Using HTML and CSS
Creating a login page is a fundamental skill for any web developer. With just HTML and CSS, you can build a clean, functional login form. Here’s how:
1. HTML Structure
Start with a basic HTML file. The form will include fields for the username and password, and a login button.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<form>
<input type="text" placeholder="Username" required>
<input type="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
</div>
</body>
</html>
2. CSS Styling
Next, create a style.css file to style the login form.
body {
font-family: Arial, sans-serif;
background-color: #f0f2f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.login-container {
background-color: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
width: 300px;
text-align: center;
}
.login-container h2 {
margin-bottom: 20px;
color: #333;
}
.login-container input {
width: 100%;
padding: 12px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
}
.login-container button {
width: 100%;
padding: 12px;
background-color: #007bff;
border: none;
color: white;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
}
.login-container button:hover {
background-color: #0056b3;
}
3. How It Works
- HTML creates the form structure with input fields and a button.
- CSS styles the form to center it on the page and make it visually appealing.
- You can enhance this page by adding links for “Forgot Password?” or “Sign Up” and using JavaScript for form validation.
4. Result
You now have a simple, responsive login page ready to use!
-
Who Is Balendra Shah? Rapper-Turned-Politician Set to Be Nepal’s Next Prime Minister
4 Nepal’s political landscape may be on the verge of a historic transformation as rapper-turned-politician Balendra “Balen” Shah emerges as […]
-
Who Was Stephanie Buttermore? Biography, Career and Net Worth
4 Stephanie Buttermore Biography Stephanie Buttermore was a popular American fitness influencer, scientist, and YouTuber known for her educational approach […]
-
Stephanie Buttermore – Fitness Influencer and Scientist Dies at 36
4 Stephanie Buttermore: Fitness World Mourns Popular YouTuber The fitness community is mourning the loss of Stephanie Buttermore, a well-known […]
-
Osasuna vs R.C.D. Mallorca – Live Updates, Score and Match Analysis
Osasuna vs Mallorca Live Score and Match Details The La Liga match between CA Osasuna and RCD Mallorca is one […]
-
Osasuna vs R.C.D. Mallorca – La Liga Match Preview, Prediction and Key Players
4 Osasuna vs R.C.D. Mallorca: La Liga Clash Today The Spanish La Liga continues with an exciting matchup between CA […]
-
Mansfield Town vs Arsenal – FA Cup Preview, Kickoff Time and Where to Watch
4 Mansfield Town vs Arsenal: Everything You Need to Know The highly anticipated FA Cup match between Mansfield Town F.C. […]
-
Mansfield Town vs Arsenal – FA Cup Clash Shocks Football Fans
Mansfield Town vs Arsenal: FA Cup Fifth-Round Showdown The FA Cup continues to deliver exciting matchups, and one of the […]
-
HIMS Stock Analysis – Is Hims & Hers a Good Investment in 2026?
4 HIMS Stock Analysis: What Investors Need to Know The stock of Hims & Hers Health (NYSE: HIMS) has been […]
-
Hims Stock Surges After Weight-Loss Drug Partnership News
Hims Stock: Why HIMS Is Trending Today The stock of Hims & Hers Health is trending in financial markets after […]
-
FA Cup 2026: Schedule, Results and Quarter-Final Teams
4 Everything to Know About FA Cup 2026 The FA Cup continues to captivate football fans around the world. The […]











