Skip to content

Instantly share code, notes, and snippets.

@aviogreen
Last active August 29, 2015 14:19
Show Gist options
  • Save aviogreen/713a0ba321db72680fdc to your computer and use it in GitHub Desktop.
Save aviogreen/713a0ba321db72680fdc to your computer and use it in GitHub Desktop.
Search form with button search inside of text input
<form class="form-search top-left" action="" method="get">
<span class="sr-only">Search for: </span>
<input type="text" placeholder="Search..." id="s" name="s">
<button id="searchsubmit" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</form>
.form-search {
@background: white;
@border-color: @brand-primary;
@active-background: white;
@active-border-color: darken(@border-color, 10%);
@border-radius: 0;
width: 200px;
position: relative;
#s {
border: 1px solid @border-color;
padding: 5px 40px 5px 15px;
width: 100%;
.border-radius(@border-radius);
background: @background;
}
#s:focus {
background: @active-background;
border-color: @active-border-color;
}
#s:focus+#searchsubmit {
background: @active-background;
border-top-color: @active-border-color;
border-right-color: @active-border-color;
border-bottom-color: @active-border-color;
}
#searchsubmit {
border: 1px solid @border-color;
border-left: none;
position: absolute;
border-radius: 0 @border-radius @border-radius 0;
margin-left: -36px;
padding: 5px 10px;
background: @background;
top: 0;
right: 0;
height: 100%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment