// ----------- Expanding Search bar in header .sb-search { position: relative; //margin-top: 10px; //width: 0%; //min-width: 60px; width: 60px; height: 45px; float: right; overflow: hidden; -webkit-transition: width 0.3s; -moz-transition: width 0.3s; transition: width 0.3s; -webkit-backface-visibility: hidden; border-right: 1px solid $brand-color-4; border-left: 1px solid $brand-color-4; background: transparent !important; margin-left: 10px; margin-bottom: 0 !important; } .sb-search-input { position: absolute; top: 0; left: 10px; border: none !important; outline: none !important; background: transparent !important; font-family: inherit; font-size: 15px; //line-height: 45px; width: 260px; height: 45px; margin: 0 !important; padding: 8px 0 0 0 !important; z-index: 10; //padding: 1rem; color: $brand-color-2 !important; font-weight: normal !important; font-weight: 400 !important; } input[type="search"].sb-search-input { -webkit-appearance: none; -webkit-border-radius: 0px; } .sb-search-input::-webkit-input-placeholder { color: $brand-color-4 !important; font-size: 15px !important; } .sb-search-input:-moz-placeholder { color: $brand-color-4 !important; font-size: 15px !important; } .sb-search-input::-moz-placeholder { color: $brand-color-4 !important; font-size: 15px !important; } .sb-search-input:-ms-input-placeholder { color: $brand-color-4 !important; font-size: 15px !important; } .sb-icon-search, .sb-search-submit { width: 60px; height: 45px; display: block; position: absolute; right: 0; top: 0; padding: 0; margin: 0; line-height: 45px; text-align: center; cursor: pointer; } /* Initially, we will want to have the icon button clickable. Then, when we open the input, we want the submit input to be clickable. So, well set the z-index of the submit input to -1 in the beginning and make it transparent, so that we always see the search icon span: */ .sb-search-submit { background: $brand-color-3; /* IE needs this */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE 8 */ filter: alpha(opacity=0); /* IE 5-7 */ opacity: 0; color: transparent; border: none; outline: none; z-index: -1; } /* Why not just set the background to transparent? That does not seem to work nicely in IE because the element is not clickable like that. So we use a solid background color and set the opacity to 0 instead. The search icon span will have a high z-index initially, because we want it to be on top of everything. We’ll use the pseudo-element :before to add the search icon: */ .sb-icon-search { color: $brand-color-2; background: $brand-color-3; z-index: 90; font-size: 16px; //font-family: 'icomoon'; font-family: 'FontAwesome'; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; -webkit-font-smoothing: antialiased; } .sb-icon-search:before { content: "\f002"; } .sb-icon-search:after { content: " Search"; } /* With the styles defined the way we did, we can now simply set the width of the sb-search wrapper to be 100% when we add the sb-search-open class. Without JavaScript, we want the search input to be open by default: */ .sb-search.sb-search-open, .no-js .sb-search { width: 260px; } /* Let’s change the color of the search icon span and put it below the submit input by setting the z-index to a lower value: */ .sb-search.sb-search-open .sb-icon-search, .no-js .sb-search .sb-icon-search { background: $brand-color-3; color: $brand-color-2; z-index: 11; } /* And finally, we set the submit input’s z-index to a higher value so that we can click on it: */ .sb-search.sb-search-open .sb-search-submit, .no-js .sb-search .sb-search-submit { z-index: 99999; }