content logo

Bootstrap Search Boxes:

Search Form with Filter Button in Bootstrap

Search bars are graphical elements in old and modern websites which help you find what you need in just a few seconds. Typically, search boxes consist of a single input box and a search icon which starts the process. Once the user types in the input (e.g. a keyword), they can press the search button after which the system will find all the items with the searched keyword in it and display it for you. These handy little features can help your website by a great amount. No one wants to be confused and be left looking for what they need for an hour. It will frustrate your users sooner than you can think of and therefor you will lose visitors at an extreme rate. This is why search boxes are one of the most vital prats of each site.

Fortunately, a simple Bootstrap search bar will do. You really don’t have to go for fancy CSS search boxes with extreme styles and busy effects. In this post, we have code for you that is able to do just that. It is a pretty simple bootstrap search bar with button and does the job efficiently and lets your users search for what they want. The code also has a toggle button with search box.

#

Bootstrap Search Bar

#

CSS Search Box

#

Search Box with Button

#

Toggle Button with Search

<!-- This script got from frontendfreecode.com -->
<div class="container">
    <div class="row">
        <div class="span1">
            <div class="btn-group pull-center" data-toggle="buttons-radio">
                <button class="btn active">All</button>
                <button class="btn">Starred</button>
            </div>
        </div>
        <div class="span1">
            <form class="form-search">
                <div class="input-append">
                    <input type="text" class="span2" />
                    <button type="submit" class="btn">Search</button>
                </div>
            </form>
        </div>
    </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
body{
    margin-top:20px;
}
.container {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.pull-center {
    display: flex;
    text-align: center;
    justify-content: center;
    margin: auto;
    margin-bottom: 10px;
}
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<style>
body{
    margin-top:20px;
}
.container {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.pull-center {
    display: flex;
    text-align: center;
    justify-content: center;
    margin: auto;
    margin-bottom: 10px;
}
</style>

</head>
<body>
<div class="container">
    <div class="row">
        <div class="span1">
            <div class="btn-group pull-center" data-toggle="buttons-radio">
                <button class="btn active">All</button>
                <button class="btn">Starred</button>
            </div>
        </div>
        <div class="span1">
            <form class="form-search">
                <div class="input-append">
                    <input type="text" class="span2" />
                    <button type="submit" class="btn">Search</button>
                </div>
            </form>
        </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