Bootstrap snippet and html example. search bar

This html snippet was created to help web designers, web developers, front-end and back-end developer save time. Use it for free in your project and build your app faster, You can also download the HTML, CSS, and JS code.

HTML code

This is the html code used to create this bootstrap snippet, You can copy and paste the following html code inside a page with bootstrap 4.3.1 included, to get the result that you can see in the preview selection


<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark fixed-top">
    <div class="container">
      <a class="navbar-brand" href="index.html">Start Bootstrap</a>
      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarResponsive">
        <ul class="navbar-nav ml-auto">
          <li class="nav-item">
            <a class="nav-link" href="about.html">About</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="services.html">Services</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="contact.html">Contact</a>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownPortfolio" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              Portfolio
            </a>
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownPortfolio">
              <a class="dropdown-item" href="portfolio-1-col.html">1 Column Portfolio</a>
              <a class="dropdown-item" href="portfolio-2-col.html">2 Column Portfolio</a>
              <a class="dropdown-item" href="portfolio-3-col.html">3 Column Portfolio</a>
              <a class="dropdown-item" href="portfolio-4-col.html">4 Column Portfolio</a>
              <a class="dropdown-item" href="portfolio-item.html">Single Portfolio Item</a>
            </div>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownBlog" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              Blog
            </a>
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownBlog">
              <a class="dropdown-item" href="blog-home-1.html">Blog Home 1</a>
              <a class="dropdown-item" href="blog-home-2.html">Blog Home 2</a>
              <a class="dropdown-item" href="blog-post.html">Blog Post</a>
            </div>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownBlog" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              Other Pages
            </a>
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownBlog">
              <a class="dropdown-item" href="full-width.html">Full Width Page</a>
              <a class="dropdown-item" href="sidebar.html">Sidebar Page</a>
              <a class="dropdown-item" href="faq.html">FAQ</a>
              <a class="dropdown-item" href="404.html">404</a>
              <a class="dropdown-item" href="pricing.html">Pricing Table</a>
            </div>
          </li>
        </ul>
        
        <!--search form -->

        <div class="search-form active-white ml-auto my-0">
          <form class="form-inline">
            <button class="search-button search-button-right" type="submit">
              <i class="fa fa-search search-text" aria-hidden="true"></i>
            </button>
            <input class="search-form-input text-white" type="search" placeholder="Search" aria-label="Search">
          </form>
        </div>
        
      </div>

    </div>
  </nav>

<div class="container">
  <!-- Left button -->
  <div class="row">
    <!-- white -->
    <div class="card-body">
         <div class="search-form active-white ml-auto my-0">
          <form class="form-inline">
            <button class="search-button search-button-left" type="submit">
              <i class="fa fa-search search-text" aria-hidden="true"></i>
            </button>
            <input class="search-form-input text-white" type="search" placeholder="Search" aria-label="Search">
          </form>
        </div>
    </div>
    <!-- pink -->
    <div class="card-body">
         <div class="search-form active-pink ml-auto my-0">
          <form class="form-inline">
            <button class="search-button search-button-left" type="submit">
              <i class="fa fa-search search-text" aria-hidden="true"></i>
            </button>
            <input class="search-form-input text-white" type="search" placeholder="Search" aria-label="Search">
          </form>
        </div>
    </div>
    <!-- blue -->
    <div class="card-body">
         <div class="search-form active-blue ml-auto my-0">
          <form class="form-inline">
            <button class="search-button search-button-left" type="submit">
              <i class="fa fa-search search-text" aria-hidden="true"></i>
            </button>
            <input class="search-form-input text-white" type="search" placeholder="Search" aria-label="Search">
          </form>
        </div>
    </div>
  </div>
  <!-- Right button -->
  <div class="row">
    <!-- white -->
    <div class="card-body">
         <div class="search-form active-white ml-auto my-0">
          <form class="form-inline">
            <button class="search-button search-button-right" type="submit">
              <i class="fa fa-search search-text" aria-hidden="true"></i>
            </button>
            <input class="search-form-input text-white" type="search" placeholder="Search" aria-label="Search">
          </form>
        </div>
    </div>
    <!-- pink -->
    <div class="card-body">
         <div class="search-form active-pink ml-auto my-0">
          <form class="form-inline">
            <button class="search-button search-button-right" type="submit">
              <i class="fa fa-search search-text" aria-hidden="true"></i>
            </button>
            <input class="search-form-input text-white" type="search" placeholder="Search" aria-label="Search">
          </form>
        </div>
    </div>
    <!-- blue -->
    <div class="card-body">
         <div class="search-form active-blue ml-auto my-0">
          <form class="form-inline">
            <button class="search-button search-button-right" type="submit">
              <i class="fa fa-search search-text" aria-hidden="true"></i>
            </button>
            <input class="search-form-input text-white" type="search" placeholder="Search" aria-label="Search">
          </form>
        </div>
    </div>
  </div>
</div>

CSS code

This is the css code used to create this bootstrap snippet, You can copy and paste the following css code inside a page with bootstrap 4.3.1 included, to get the result that you can see in the preview selection


.row{
  margin-top: 50px;
}
.card-body{
  margin-top: 50px;
  background-color: #455A64;
  border: 1px solid #fff;
}

.search-form {
  position: relative;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.search-form .search-form-input {
  height: auto;
  width: 100%;
  margin: 0 0 .5rem 0;
  padding: .6rem 0 .4rem 0;
  padding-left: 25px;
  padding-right: 25px;
  transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  outline: 0;
  border: none;
  border-bottom: 1px solid #ced4da;
  border-radius: 0;
  box-sizing: content-box;
  box-shadow: none;
  background-color: transparent;

}

.search-button{
  position: absolute;
  padding-bottom: 5px;
  background: transparent;
  outline: none;
  border: none;
  
  &-left{
  padding-left: 0;
  padding-right: 0;
  }
  
  &-right{
    padding-left: 0;
    right: 0; 
  }
}

.search-text {
  color: rgba(255,255,255,.5);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

.active-white input[type=search]:focus:not([readonly]) {
  border-bottom: 1px solid #fff;
  box-shadow: 0 1px 0 0 #fff;
  color: #fff;
}

.active-pink input[type=search]:focus:not([readonly]) {
  border-bottom: 1px solid #F48FB1;
  box-shadow: 0 1px 0 0 #F48FB1;
  color: #fff;
}

.active-blue input[type=search]:focus:not([readonly]) {
  border-bottom: 1px solid #1E88E5;
  box-shadow: 0 1px 0 0 #1E88E5;
  color: #fefefe;

}

/* clears the 'X' from Internet Explorer */
input[type=search]::-ms-clear {  display: none; width : 0; height: 0; }
input[type=search]::-ms-reveal {  display: none; width : 0; height: 0; }

/* clears the 'X' from Chrome */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration { display: none; }


















Similar snippets

Bootstrap example and template. bs4 payment list

bs4 payment list

Bootstrap example and template. social network profile head

social network profile head

Bootstrap example and template. alerts with arrow

alerts with arrow

Bootstrap example and template. user profile description

user profile description

Bootstrap example and template. bs4 crud users

bs4 crud users

Bootstrap example and template. chat app

chat app

Bootstrap example and template. animated chat window

animated chat window

Bootstrap example and template. table user list

table user list

Bootstrap example and template. search bar

About this bootstrap example/template

We hope you will enjoy this awesome snippet and stay tuned for the latest updates, bootdey snippets are already used in thousands of blogs, websites and projects. We believe it will save your precious time and gives trendy look to your next web project.

We always try to offer the best beautiful and responsive source of Bootstrap code examples and components.

This code example currectly have 1.8K views, Using this bootstrap snippet you have the following benefits:

Bootstrap 4.3.1

<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css'>

<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js'></script>

This code example is based on bootstrap 4.3.1 and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This code example can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working