"nav & search"
Bootstrap 3.0.0 Snippet by evarevirus

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html><html class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/JeremyPP/pen/xqRZgb?depth=everything&limit=all&order=popularity&page=48&q=material+&show_forks=false" /> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700" rel="stylesheet"> <style class="cp-pen-styles"> /* ========== Main Styles ========== */ html, body { margin: 0; padding: 0; } body { font-family: 'Roboto', sans-serif; -webkit-font-smoothing: antialiased; background-color: #fff; } /* Disable selection with class "noUserSelect" */ .noUserSelect { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* ========== Page header (Top bar) ========== */ .page-header { width: 100%; width: 100%; position: fixed; background: #6472cd; top: 0; z-index: 500; height: 64px; max-height: 64px; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } /* Search bar (header) */ .searchBarMain { background: #fff; width: 80%; max-width: 680px; margin: 0 auto; height: 42px; margin-top: 11px; border-radius: 2px; box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.14); -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -ms-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; position: fixed; left: 0; right: 0; top: 0 } .searchBarMain i.searchBarSearchIcon { height: 100%; line-height: 42px; float: left; width: 52px; text-align: center; color: rgba(68, 68, 68, 0.5); } .searchBarMain input#searchBarInput { height: 42px; padding: 0; margin: 0; border: 0; box-sizing: border-box; background: transparent; width: calc(100% - 52px); outline: none; padding-right: 32px; font-size: 16px; color: rgba(0, 0, 0, 0.76); font-weight: 400; font-family: 'Roboto', sans-serif; } .searchBarMain i.clearSearchBarField { position: absolute; right: 12px; top: 11px; color: rgba(0, 0, 0, 0.84); display: none; font-size: 20px; } .searchBarMain i.clearSearchBarField:hover { cursor: pointer; }</style></head><body> <header class="page-header"> <div></div> <div class="searchBarMain"> <i class="material-icons searchBarSearchIcon noUserSelect">search</i> <input type="text" name="header-search" value="" id="searchBarInput" placeholder="Search, discover, explore..."> <i class="material-icons clearSearchBarField noUserSelect" onClick="resetInput()">clear</i> </div> <nav></nav> </header> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script >var searchBarInput = $("#searchBarInput"); var clearSearchBtn = $(".clearSearchBarField"); $(document).ready(function() { searchBarInput.keyup(function() { if( $(this).val().length === 0 ) { clearSearchBtn.hide() } else { clearSearchBtn.show() } }); }); function resetInput() { clearSearchBtn.hide(); searchBarInput.val('').focus(); } //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: