content logo

Bootstrap Forms:

Float On Border Label for Bootstrap Forms

In this post, we have prepared a functional code with a simple theme. You probably have seen this kind of code on many websites. The Float On Border Label for Bootstrap Forms is one of the best sections on all websites. If you have a website and provide services to your audiences, we recommend you to use this Bootstrap Form Code. As a result, people who fill out this form can see and use your services. The Contact Us Form Code helps people enter websites with their username and password. So, you can use this code and change the design of your page easily.

This Bootstrap Floating Label has a simple theme with a white background. The title exists at the top of the page. This page includes several fields and people should fill in the blanks with their personal information. For example, the first section is designed for a name and the second one shows the last name. Then, the other sections are designed for the rest of the information. In the last field of the Label Float to Border, you can add your message about the website and the admin can see it easily and use your opinion to improve their page.

#

Bootstrap Form Code

#

Bootstrap Floating Lable

#

Contact Us Form Code

#

Lable Float to Border

<!-- This script got from frontendfreecode.com -->
<div class="container pt-5">
  <div class="row">
    <div class="col-12">
      <h1 class="fs-1 mb-3">Contact us</h1>
    </div>
    <!-- NAME -->
    <div class="col-12 col-md-6">
      <div class="floating-form mb-3">
        <input type="text" class="form-control" id="name" autocomplete="off" required />
        <label for="name">Name</label>
      </div>
    </div>
    <!-- LASTNAME -->
    <div class="col-12 col-md-6">
      <div class="floating-form mb-3">
        <input type="text" class="form-control" id="lastname" autocomplete="off" required />
        <label for="lastname">Lastname</label>
      </div>
    </div>
    <!-- E-MAIL -->
    <div class="col-12 col-md-6 mb-3">
      <div class="floating-form ">
        <input type="email" class="form-control" id="email" autocomplete="off" required />
        <label for="email">Email</label>
      </div>
      <small class="ps-2 text-muted">ex: name@domain.com</small>
    </div>
    <!-- GSM -->
    <div class="col-12 col-md-6">
      <div class="floating-form mb-3">
        <input type="tel" class="form-control" id="phone" autocomplete="off" required />
        <label for="phone">Mobile phone number</label>
      </div>
    </div>
    <!-- SUBJECT -->
    <div class="col-12">
      <div class="floating-form mb-3">
        <input type="text" class="form-control" id="subject" autocomplete="off" required />
        <label for="subject">subject</label>
      </div>
    </div>
    <!-- MESSAGE -->
    <div class="col-12">
      <div class="floating-form mb-3">
        <textarea class="form-control" rows="8" id="message" autocomplete="off" required></textarea>
        <label for="message">message</label>
      </div>
    </div>
  </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
.floating-form {
  position: relative;
}
.floating-form .form-control {
  background: transparent;
  position: relative;
  z-index: 50;
}
.floating-form .form-control:focus, .floating-form .form-control:active, .floating-form .form-control:valid {
  outline: none !important;
  box-shadow: none !important;
}
.floating-form .form-control:focus + label, .floating-form .form-control:active + label, .floating-form .form-control:valid + label {
  transform: translateY(-40%);
  top: -2px;
  z-index: 100;
  font-size: 12px;
}
.floating-form label {
  position: absolute;
  top: 50%;
  /* bootstrap > input > padding size */
  left: 0.75rem;
  z-index: 1;
  font-size: 14px;
  transform: translateY(-50%);
  transition: all 0.3s;
  background: #fff;
  color: #afafaf;
}
.floating-form textarea + label {
  top: 1.275rem;
}
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css'>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css'>
<style>
.floating-form {
  position: relative;
}
.floating-form .form-control {
  background: transparent;
  position: relative;
  z-index: 50;
}
.floating-form .form-control:focus, .floating-form .form-control:active, .floating-form .form-control:valid {
  outline: none !important;
  box-shadow: none !important;
}
.floating-form .form-control:focus + label, .floating-form .form-control:active + label, .floating-form .form-control:valid + label {
  transform: translateY(-40%);
  top: -2px;
  z-index: 100;
  font-size: 12px;
}
.floating-form label {
  position: absolute;
  top: 50%;
  /* bootstrap > input > padding size */
  left: 0.75rem;
  z-index: 1;
  font-size: 14px;
  transform: translateY(-50%);
  transition: all 0.3s;
  background: #fff;
  color: #afafaf;
}
.floating-form textarea + label {
  top: 1.275rem;
}
</style>

</head>
<body>
<div class="container pt-5">
  <div class="row">
    <div class="col-12">
      <h1 class="fs-1 mb-3">Contact us</h1>
    </div>
    <!-- NAME -->
    <div class="col-12 col-md-6">
      <div class="floating-form mb-3">
        <input type="text" class="form-control" id="name" autocomplete="off" required />
        <label for="name">Name</label>
      </div>
    </div>
    <!-- LASTNAME -->
    <div class="col-12 col-md-6">
      <div class="floating-form mb-3">
        <input type="text" class="form-control" id="lastname" autocomplete="off" required />
        <label for="lastname">Lastname</label>
      </div>
    </div>
    <!-- E-MAIL -->
    <div class="col-12 col-md-6 mb-3">
      <div class="floating-form ">
        <input type="email" class="form-control" id="email" autocomplete="off" required />
        <label for="email">Email</label>
      </div>
      <small class="ps-2 text-muted">ex: name@domain.com</small>
    </div>
    <!-- GSM -->
    <div class="col-12 col-md-6">
      <div class="floating-form mb-3">
        <input type="tel" class="form-control" id="phone" autocomplete="off" required />
        <label for="phone">Mobile phone number</label>
      </div>
    </div>
    <!-- SUBJECT -->
    <div class="col-12">
      <div class="floating-form mb-3">
        <input type="text" class="form-control" id="subject" autocomplete="off" required />
        <label for="subject">subject</label>
      </div>
    </div>
    <!-- MESSAGE -->
    <div class="col-12">
      <div class="floating-form mb-3">
        <textarea class="form-control" rows="8" id="message" autocomplete="off" required></textarea>
        <label for="message">message</label>
      </div>
    </div>
  </div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>

</body>
</html>
Preview