How To Create Login Page In Html Using Notepad

HTML Programming

Creating a login page in HTML using Notepad is a great way to learn the basics of web development. With just a few lines of code, you can build a simple and functional login page that allows users to access a protected area of your website. In this article, I will guide you through the process of creating a login page from scratch using Notepad. So, let’s get started!

Setting up the HTML Structure

The first step is to set up the basic structure of our HTML page. Open Notepad and create a new file. Start by adding the HTML declaration at the beginning of the file:

<!DOCTYPE html>

Next, create the HTML opening and closing tags:


Within the HTML tags, add the head and body sections. The head section is where we define the title of our webpage:

<title>My Login Page</title>

Now, let’s move on to the body section where we will build our login page:


Creating the Login Form

To create the login form, we need to use the <form> tag. Within this tag, we will add the input fields for the username and password, as well as a submit button:

<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<input type="submit" value="Login">

Feel free to customize the input fields and submit button to match your desired design.

Adding CSS Styles

While our login form is functional, it may not look very appealing yet. To add some visual styles, we can use CSS. Create a new CSS file and link it to your HTML file by adding the following line within the head section:

<link rel="stylesheet" type="text/css" href="styles.css">

In the styles.css file, you can write CSS rules to customize the appearance of the login form. For example, you can change the background color, font style, and layout to make it more visually appealing.

Handling the Login Process

Now that we have our login form, we need to handle the login process. In a real scenario, you would typically connect to a server-side script or a database to validate the user credentials. However, since we are focusing on the HTML part, we will use a simple JavaScript function to simulate the login process:

function login() {
    var username = document.getElementsByName("username")[0].value;
    var password = document.getElementsByName("password")[0].value;
    if (username === "admin" && password === "password") {
        alert("Login successful!");
    } else {
        alert("Invalid username or password");

Add the login() function to the submit button by modifying the HTML code as follows:

<input type="submit" value="Login" onclick="login()">

Now, when the user clicks the login button, the login() function will be triggered and check if the entered username and password match the predefined values. You can customize the username and password in the JavaScript function to match your desired login credentials.


Creating a login page in HTML using Notepad is a great way to practice your web development skills. Although this login page is simple, it demonstrates the fundamental concepts of HTML, CSS, and JavaScript. By expanding upon this foundation, you can build more sophisticated login systems and enhance the security of your website. So, go ahead and start experimenting with your own login page!