Responsive Login Form in Bootstrap Download Source Code
Bootstrap makes each form field responsive, that's why most people use the Bootstrap form. Here we have made a basic simple form that is responsive. You don't have to do much just copy and paste the code below and create a responsive form.
Responsive Login Form |
So let's start, first of all, create a folder inside your C:\xampp\htdocs named register-form, keep in mind the location of your file should be C:\xampp\htdocs/register-form/
We will create a file inside the register-form folder named login.php, you can name it whatever you want and you can keep any name of the folder.
note - Make sure your local like xampp is on
Open the login.php file in any code editor like sublime, VSstudio, or note++ because we are going to write the code inside it.
After opening the login.php file, inside it, copy the code given below and paste it into your login.php file.
See the Pen Responsive Login Form in Bootstrap by Ramkrishna Sahu (@ramkrishna-sahu) on CodePen.
Here we have used Bootstrap 5's CDN which makes the form more attractive.
After pasting the code, go to any web browser and type http://localhost/register-form/login.php in the URL bar. Now your login form will appear like this ↓
Congratulations! Your Responsive Login Form is ready. Now let us understand its basic code
Understand The Basic Code of the Login Form
In the above code, first, we have defined the HTML document type, after that link the CDN of Bootstrap 5 inside the <head> section, if you want, you can also use the CDN of bootstrap 4, 3, this cdn in designing the form Also in the footer we have linked the script of Bootstrap which will help in validating the form.
Now come inside the tag, here we have given a class name to the form tag as well as used the needs-validation element, this validation will work when the input field is empty and submitted by the user.
You can use different validation classes to provide valuable feedback to users. Add either .was-validated or .needs-validation to the
element, depending on whether you want to provide validation feedback before or after submitting the form. The input fields will have a green (valid) or red (invalid) border to indicate what's missing in the form. You can also add a .valid-feedback or .invalid-feedback message to tell the user explicitly what's missing, or needs to be done before submitting the form - according to w3school
<lable> tag is used to name the input field whose main element is the "for" attribute. If "enter email" First name is placed then id="enteremail"of the input field should be the same means that the label has to be connected to the input field.
The next tag is the input tag. The bootstrap class form-control of this tag will control the design of the entire form and have also added the rounded-pil class which will make the border of the input field in a rounded shape.
Similarly, if you want to take input from all the users, then copy and paste the same code for each and change its field name.
Finally, on the submit button, here is a button type submit button, using the class of bootstrap, whose name is submitted or you can name it anything.
Conclusions:
In the Next Tutorial Will look at the form validation and do everything carefully. If you face any problem related to this tutorial, then please write in the comment box below, and we will help you as soon as possible.
Download Simple Login Form Source Code in Bootstrap
Thanks For Reading........
Go to Preview - How to make Responsive Login Form in Bootstrap
0 Comments