Login formTutorials

Login form Bootstrap 4

Login form Bootstrap 4

how to create a Login form Bootstrap 4

Before We Start

Every developer needs clean and modern elements to develop their websites, It contains pictures and a user interface element within a website. The most important one and the first section that the user sees when the user enters a website. Login form Bootstrap 4

So if you are a person who wishes to develop a website, you have to know how to create that properly.

how to create a Login form Bootstrap 4

We are here to solve your problem. In this article we discuss how to create these elements. Before we start please read the below articles which easier you to understand the process, if you are new to development.

Step 1 – Add HTML

It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag.


<div class="global-container">
	<div class="card login-form">
		<div class="card-body">
			<h3 class="card-title text-center">Log in to W3schoolWeb</h3>
			<div class="card-text">
				<!--
			<div class="alert alert-danger alert-dismissible fade show" 
             role="alert">Incorrect username or password.</div> -->
				<form>
					<!-- to error: add class "has-danger" -->
					<div class="form-group">
						<label for="exampleInputEmail1">Email address</label>
						<input type="email" class="form-control form-control-sm" 
                    id="exampleInputEmail1" aria-describedby="emailHelp">
					</div>
					<div class="form-group">
						<label for="exampleInputPassword1">Password</label>
						<a href="#" style="float:right;font-size:12px;">Forgot password? 
               </a>
						<input type="password" class="form-control form-control-sm" 
              id="exampleInputPassword1">
					</div>
					<button type="submit" class="btn btn-primary btn-block">Signin</button>

					<div class="sign-up">
						Don't have an account? 
                     <ahref="https://w3schoolweb.com/bootstraplogin-page/">Create One</a>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

Step 2 – Add CSS

We use some external CSS link to this code. No need to worry about this, copy and paste below code between <style></style> tag.


<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.2/css/bootstrap.min.css">
</head>

Copy and paste below code in your HTML editor between <style></style> tag.

<style>
html,
body {
	height: 100%;
}

.global-container {
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgb(238,174,202);
background: radial-gradient(circle, rgba(238,174,202,1) 0%, rgba(148,187,233,1) 100%);
}

form {
	padding-top: 10px;
	font-size: 14px;
	margin-top: 30px;
}

.card-title {
	font-weight: 300;
}

.btn {
	font-size: 14px;
	margin-top: 20px;
}

.login-form {
	width: 330px;
	margin: 20px;
}

.sign-up {
	text-align: center;
	padding: 20px 0 0;
}

.alert {
	margin-bottom: -30px;
	font-size: 13px;
	margin-top: 20px;
}

</style>

At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.

Your Output

Login form Bootstrap 4

Video Tutorial

Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.


Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button