content logo

Bootstrap Search Boxes:

Interactive Bootstrap Search Box

Even though, search boxes are advantageous to every website, generally, larger websites with a lot of complex pages and hundreds of subpages benefit a lot more from a Bootstrap search box than some smaller sites do. This is mainly due to the fact that users tend to rely on search when they face complexity and extensive click navigation. Often times, people prefer to type what they need to find rather than keep looking for it among the category lists as it needs less processing power from their brain and therefore it is easier. With that said, sometimes we don’t have enough physical space in a web page to insert a search box as well as other features. There is a fix to this issue however.

The Bootstrap search result code we are showing you in this post consists of a simple search icon with a light blue background. Once the icon is clicked, however, the actual search bar expands and since this is an animated Bootstrap search box, the motion happens in a circular animation. You can then easily search what you need in the search field and let the system find it for you. Clicking anywhere besides the actual field closes the search box and everything goes back to normal. You can get the CSS search result code right away if you scroll down to the respective section.

#

Bootstrap Search Result

#

CSS Search Result

#

Bootstrap Search

#

Animated Bootstrap Search Box


<!-- This script got from frontendfreecode.com -->
<div id="app-cover">
  <div id="app">
    <form method="get" action="">
      <div id="f-element">
        <div id="inp-cover"><input type="text" name="query" placeholder="Type something to search ..." autocomplete="off"></div>
      </div>
      <button type="submit" class="shadow"><i class="fas fa-search"></i></button>
    </form>
  </div>
  <div id="layer" title="Click the blue area to hide the form"></div>
  <div id="init"></div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
* {
    outline: none;
}

html, body {
    height: 100%;
    min-height: 100%;
}

body {
    margin: 0;
}

body, input {
    cursor:  32 32, auto;
    cursor: -webkit-image-set( 1x, 2x) 32 32, auto;
}

    body:active, input:active {
        cursor:  32 32, auto;
        cursor: -webkit-image-set(  1x, 2x ) 32 32, auto;
    }

#app-cover {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    width: 434px;
    margin: -41px auto 0 auto;
}

#app {
    position: relative;
    width: 82px;
    height: 82px;
    border-radius: 120px;
    margin: 0 auto;
    transition: 0.15s ease width;
    z-index: 2;
}

form {
    position: relative;
    height: 82px;
    cursor: auto;
    border-radius: 120px;
}

#f-element {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    border-radius: 120px;
}

#inp-cover {
    position: absolute;
    top: 0;
    right: 41px;
    bottom: 0;
    left: 0;
    padding: 0 35px;
    background-color: #fff;
}

input {
    display: block;
    width: 100%;
    font-size: 19px;
    font-family: Arial, Helvetica, sans-serif;
    color: #00688a;
    border: 0;
    padding: 30px 0;
    margin: 0;
    margin-top: 52px;
    line-height: 1;
    background-color: transparent;
    transition: 0.15s ease margin-top;
    cursor: auto;
}

button {
    position: absolute;
    top: 0;
    right: 0;
    width: 82px;
    height: 82px;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    padding: 26px;
    margin: 0;
    border: 0;
    background-color: #1eaddc;
    transition: 0.2s ease background-color;
    border-radius: 50%;
}

    button.shadow {
        box-shadow: 0 10px 30px #d0d0d0;
    }

    button i.fas {
        display: block;
        line-height: 1;
    }

#layer {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #1eaddc;
    transition: 0.9s ease all;
    z-index: 1;
}

    #layer.sl {
        transition: 0.3s ease all;
    }

#layer, #init {
    position: fixed;
    top: 50%;
    margin: -40px auto 0 auto;
}

#layer {
    right: -100px;
    left: -100px;
}

#init {
    right: 0;
    left: 0;
    width: 82px;
    height: 82px;
    cursor: pointer;
    z-index: 2;
}

#app.opened {
    width: 434px;
    box-shadow: 0 10px 30px #0190bf;
}

.opened input.move-up {
    margin-top: 0;
}

.opened button {
    color: #1eaddc;
    background-color: #fff;
    box-shadow: none;
    cursor: pointer;
}

#app.opened + #layer {
    width: 4000px;
    height: 4000px;
    margin-top: -2000px;
    opacity: 1;
    z-index: 0;
}

#app.opened ~ #init {
    z-index: -1;
}
$(function () {
    var app = $('#app'), init = $('#init'), layer = $('#layer'), input = $('#inp-cover input'), button = $('button');

    function toggleApp() {
        app.toggleClass('opened');

        if (button.hasClass('shadow'))
            button.toggleClass('shadow');
        else
            setTimeout(function () { button.toggleClass('shadow'); }, 300);

        if (app.hasClass('opened')) {
            setTimeout(function () { input.toggleClass('move-up'); }, 200);
            setTimeout(function () { input.focus(); }, 500);
        }
        else
            setTimeout(function () { input.toggleClass('move-up').val(''); }, 200);

        if (!layer.hasClass('sl')) {
            setTimeout(function () {
                layer.addClass('sl');
            }, 800);
        }
        else
            setTimeout(function () { layer.removeClass('sl'); }, 300);
    }

    layer.on('click', toggleApp);
    init.on('click', toggleApp);
});
<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.3.1/css/all.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.3.1/css/all.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<style>
* {
    outline: none;
}

html, body {
    height: 100%;
    min-height: 100%;
}

body {
    margin: 0;
}

body, input {
    cursor:  32 32, auto;
    cursor: -webkit-image-set( 1x, 2x) 32 32, auto;
}

    body:active, input:active {
        cursor:  32 32, auto;
        cursor: -webkit-image-set(  1x, 2x ) 32 32, auto;
    }

#app-cover {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    width: 434px;
    margin: -41px auto 0 auto;
}

#app {
    position: relative;
    width: 82px;
    height: 82px;
    border-radius: 120px;
    margin: 0 auto;
    transition: 0.15s ease width;
    z-index: 2;
}

form {
    position: relative;
    height: 82px;
    cursor: auto;
    border-radius: 120px;
}

#f-element {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    border-radius: 120px;
}

#inp-cover {
    position: absolute;
    top: 0;
    right: 41px;
    bottom: 0;
    left: 0;
    padding: 0 35px;
    background-color: #fff;
}

input {
    display: block;
    width: 100%;
    font-size: 19px;
    font-family: Arial, Helvetica, sans-serif;
    color: #00688a;
    border: 0;
    padding: 30px 0;
    margin: 0;
    margin-top: 52px;
    line-height: 1;
    background-color: transparent;
    transition: 0.15s ease margin-top;
    cursor: auto;
}

button {
    position: absolute;
    top: 0;
    right: 0;
    width: 82px;
    height: 82px;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    padding: 26px;
    margin: 0;
    border: 0;
    background-color: #1eaddc;
    transition: 0.2s ease background-color;
    border-radius: 50%;
}

    button.shadow {
        box-shadow: 0 10px 30px #d0d0d0;
    }

    button i.fas {
        display: block;
        line-height: 1;
    }

#layer {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #1eaddc;
    transition: 0.9s ease all;
    z-index: 1;
}

    #layer.sl {
        transition: 0.3s ease all;
    }

#layer, #init {
    position: fixed;
    top: 50%;
    margin: -40px auto 0 auto;
}

#layer {
    right: -100px;
    left: -100px;
}

#init {
    right: 0;
    left: 0;
    width: 82px;
    height: 82px;
    cursor: pointer;
    z-index: 2;
}

#app.opened {
    width: 434px;
    box-shadow: 0 10px 30px #0190bf;
}

.opened input.move-up {
    margin-top: 0;
}

.opened button {
    color: #1eaddc;
    background-color: #fff;
    box-shadow: none;
    cursor: pointer;
}

#app.opened + #layer {
    width: 4000px;
    height: 4000px;
    margin-top: -2000px;
    opacity: 1;
    z-index: 0;
}

#app.opened ~ #init {
    z-index: -1;
}
</style>

</head>
<body>
<div id="app-cover">
  <div id="app">
    <form method="get" action="">
      <div id="f-element">
        <div id="inp-cover"><input type="text" name="query" placeholder="Type something to search ..." autocomplete="off"></div>
      </div>
      <button type="submit" class="shadow"><i class="fas fa-search"></i></button>
    </form>
  </div>
  <div id="layer" title="Click the blue area to hide the form"></div>
  <div id="init"></div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
$(function () {
    var app = $('#app'), init = $('#init'), layer = $('#layer'), input = $('#inp-cover input'), button = $('button');

    function toggleApp() {
        app.toggleClass('opened');

        if (button.hasClass('shadow'))
            button.toggleClass('shadow');
        else
            setTimeout(function () { button.toggleClass('shadow'); }, 300);

        if (app.hasClass('opened')) {
            setTimeout(function () { input.toggleClass('move-up'); }, 200);
            setTimeout(function () { input.focus(); }, 500);
        }
        else
            setTimeout(function () { input.toggleClass('move-up').val(''); }, 200);

        if (!layer.hasClass('sl')) {
            setTimeout(function () {
                layer.addClass('sl');
            }, 800);
        }
        else
            setTimeout(function () { layer.removeClass('sl'); }, 300);
    }

    layer.on('click', toggleApp);
    init.on('click', toggleApp);
});
</script>

</body>
</html>
Preview