Registration Form using Bootstrap with Source Code

Registration Form using Bootstrap with Source Code
October 01, 2021

A bootstrap is a popular tool for creating web pages and websites. It's a great resource because it provides a lot of predesigned components, colors, and layouts to make the process of designing websites much easier for designers. This article shows how to create a registration form with Bootstrap using source code.

Copy-paste the stylesheet <link> into your <head> before all other stylesheets to load our CSS.

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">

Also, add bootstrap icons CSS below the bootstrap CSS

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">

Add the following stylesheet to set page background and rounded buttons in the head tag.

<style>
      .bg-color{
          background-color: #f9fbfd;
          font-family: Arial, Helvetica, sans-serif;
      }
      .btn-rounded{
          border-radius: 30px;
      }
</style>


Use the following code for the Registration form design.

<body class="bg-color">
    <section class="container mt-5">
        <div class="row justify-content-md-center">
            <form class="col-md-6 col-sm-12 bg-white p-5 rounded shadow">
                <div class="col-12 text-center">
                    <h3 class="text-primary"><strong>Register Now</strong></h3>
                </div>
                <div class="mb-3">
                    <label for="email" class="form-label">Email address</label>
                    <input type="email" class="form-control" id="email">
                </div>
                <div class="mb-3">
                    <label for="password" class="form-label">Password</label>
                    <input type="password" class="form-control" id="password">
                </div>
                <div class="mb-3">
                    <label for="confirm_password" class="form-label">Confirm Password</label>
                    <input type="password" class="form-control" id="confirm_password">
                </div>
                <div class="mb-3 form-check">
                    <input type="checkbox" class="form-check-input" id="terms">
                    <label class="form-check-label" for="terms">I agree terms and conditions.</label>
                </div>
                <div class="text-center mt-3">
                    <button type="submit" class="btn btn-primary btn-rounded w-75">Register Now</button>
                </div>
                <div class="mb-3 text-center text-secondary mt-3">
                    or register using
                </div>
                <div class="d-flex justify-content-around mb-3">
                    <button type="submit" class="btn btn-danger btn-rounded"><i class="bi bi-google"></i>&nbsp;&nbsp;Google</button>
                    <button type="submit" class="btn btn-primary btn-rounded"><i class="bi bi-facebook"></i>&nbsp;&nbsp;Facebook</button>
                    <button type="submit" class="btn btn-primary btn-rounded"><i class="bi bi-linkedin"></i>&nbsp;&nbsp;Linkedin</button>
                </div>
            </form>
        </div>
    </section>
</body>


Bootstrap classes description:

  • container: to design layouts
  • row: to design grid layout in a row and column format
  • col-md-6 - to take half-width of the screen of medium size devices like desktops and laptops
  • col-sm-12 - to take full width of screen of small size devices like mobile and tabs
  • text-center - to center text
  • mb-3: margin-bottom of 3 rem
  • d-flex - to design flex system
  • btn btn-primary - to design button with blue color
  • btn btn-danger - to design button with red color

The output of the above source code:


Resources for You

ChatGPT Guide For Software Developers

Learn to use ChatGPT to stay ahead of competition

Front-End Developer Interview Kit

Today, Start preparing to get your dream job!

JavaScript Developer Kit

Start your JavaScript journey today!

Master JavaScript by Solving Daily Challenges

Challenge Yourself Daily: Advance Your JavaScript Skills and Career

View Challenges

Newsletter for Developers!

Join our newsletter to get important Web Development and Technology Updates