You are currently viewing Easy Way to Create Attractive Search Box in Bootstrap

Easy Way to Create Attractive Search Box in Bootstrap

Search Bar Bootstrap


The search box is a crucial element in any website or application that allows users to quickly find relevant information. So In this article, we will see how to create an attractive search box in Bootstrap with examples.

Why search box?

The search box is used to search for a specific piece of information from a collection of information. If we enter a specific keyword in the search box, it will filter and display relevant information.


In this example, we will create ‘ionicons‘ cdn link to create a search icon.

<!DOCTYPE html>
   <title>Create search box</title>
   <link rel="stylesheet" href="">

<script type="module" src=""></script>
<script nomodule src=""></script>
<style type="text/css">
      position: relative;
      padding: 100px;
      background: skyblue;
   .h-search-form input{
      width: 70%;
      padding: 0 30px;
      border-radius: 50px;
      border: none;
      font-weight: 600;
      font-size: 16px;
      text-transform: capitalize;
      position: relative;
      color: #333;
      height: 70px;
   .h-search-form button{
      position: relative;
      right: 110px;
      height: 60px;
      color: #fff;
      background: blue;
      top: px;
      border-radius: 50px;
      border: none;
      width: 100px;
   .h-search-form button:hover{
      background: darkblue;
<div class="h-search-form text-center">
   <form action="#">
      <input type="search" name="search" placeholder="Search..">
      <button><ion-icon class="bi bi-search" name="search-outline"></ion-icon></button>


See the Pen
Bootstrap Search box
by Wonderdevelop (@wonderdevelop)
on CodePen.

Example 2:

In this example code, we will create the search bar using bootstrap classes.

  <div class="input-group">
    <input type="text" id="searchBox" name="searchBox" class="form-control form-control-lg" placeholder="Search...">
    <button type="submit" class="btn btn-primary">Search</button>


search box

Leave a Reply