A great technique of styling a search bar.
Forked from dodozhang21's Pen Responsive search bar.
A Pen by Konstantin Stalinsky on CodePen.
| form.search | |
| input.searchTerm placeholder="Enter your search term ..." | |
| input.searchButton type="submit" |
A great technique of styling a search bar.
Forked from dodozhang21's Pen Responsive search bar.
A Pen by Konstantin Stalinsky on CodePen.
| $('.searchButton').on('click',function(){ | |
| alert('You clicked search button'); | |
| }); |
| @import "compass/css3"; | |
| @import url(http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css); | |
| $iconColor: #fff; | |
| $color: #8FC357; | |
| .search { | |
| width: 30%; | |
| position: relative; | |
| &:before { | |
| position: absolute; | |
| top: 0; | |
| right: 0; | |
| width: 40px; | |
| height: 40px; | |
| line-height: 40px; | |
| font-family: 'FontAwesome'; | |
| content: '\f002'; | |
| background: $color; | |
| text-align: center; | |
| color: $iconColor; | |
| border-radius: 5px; | |
| -webkit-font-smoothing: subpixel-antialiased; | |
| font-smooth: always; | |
| } | |
| } | |
| .searchTerm { | |
| @include box-sizing(border-box); | |
| width: 100%; | |
| border: 5px solid $color; | |
| padding: 5px; | |
| height: 40px; | |
| border-radius: 5px; | |
| outline: none; | |
| } | |
| .searchButton { | |
| position: absolute; | |
| top: 0; | |
| right: 0; | |
| width: 40px; | |
| height: 40px; | |
| opacity: 0; | |
| cursor: pointer; | |
| } |