Last active
October 28, 2016 20:28
-
-
Save betsydupuis/aa746c6188b9f8b8b7020bb87c7cc94d to your computer and use it in GitHub Desktop.
Bootstrap Typeahead CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="row"> | |
<div class="col-xs-6 col-xs-offset-3"> | |
<h3>Bootstrap Typeahead CSS</h3> | |
</div> | |
<div class="col-xs-6 col-xs-offset-3"> | |
<form> | |
<div class="form-group typeahead"> | |
<label for="addFilter">Add a filter</label> | |
<input type="text" class="form-control typeahead-input" id="addFilter" placeholder="Start typing..."> | |
<div class="typeahead-dropdown list-group"> | |
<a href="#" class="list-group-item"> | |
Cras justo odio | |
</a> | |
<a href="#" class="list-group-item">Dapibus ac facilisis in</a> | |
<a href="#" class="list-group-item">Morbi leo risus</a> | |
<a href="#" class="list-group-item">Porta ac consectetur ac</a> | |
<a href="#" class="list-group-item">Vestibulum at eros</a> | |
</div> | |
</div> | |
</form> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-xs-6 col-xs-offset-3"> | |
<h3>Bootstrap Typeahead CSS <small></small></h3> | |
</div> | |
<div class="col-xs-6 col-xs-offset-3"> | |
<form> | |
<div class="form-group typeahead"> | |
<label for="addFilter">Add a filter</label> | |
<div class=" input-group"> | |
<span class="input-group-addon">Fruits</span> | |
<input type="text" class="form-control typeahead-input" id="addFilter" placeholder="Start typing..."> | |
<div class="typeahead-dropdown list-group"> | |
<a href="#" class="list-group-item"> | |
Cras justo odio | |
</a> | |
<a href="#" class="list-group-item">Dapibus ac facilisis in</a> | |
<a href="#" class="list-group-item">Morbi leo risus</a> | |
<a href="#" class="list-group-item">Porta ac consectetur ac</a> | |
<a href="#" class="list-group-item">Vestibulum at eros</a> | |
</div> | |
</div> | |
</div> | |
</form> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Boostrap Typeahead CSS | |
.input-group-addon { | |
width: 1%; | |
white-space: nowrap; | |
vertical-align: middle; | |
display: table-cell; | |
} | |
.input-group .form-control { | |
position: relative; | |
z-index: 2; | |
float: left; | |
width: 100%; display: table-cell; | |
margin-bottom: 0; | |
} | |
.typeahead { | |
position: relative; | |
.input-group-addon { | |
&:after { | |
content: ':'; | |
display:inline; | |
} | |
} | |
&-input { | |
position: relative; | |
z-index: 1; | |
+ .typeahead-dropdown { | |
display: none; | |
// border-top: 1px solid #aaa; | |
position: absolute; | |
top: 100%; | |
left: 0; | |
width: 100%; | |
margin-top: -2px; | |
transition-delay: 0.75s; | |
transition: display 1s; | |
> .list-group-item { | |
&:first-child { | |
border-radius: 0; | |
} | |
} | |
} | |
&:focus { | |
z-index: 100; | |
padding-bottom: 8px; | |
height: 36px; | |
border-bottom-left-radius: 0; | |
border-bottom-right-radius: 0; | |
+ .typeahead-dropdown { | |
z-index: 100; | |
display: block | |
} | |
} | |
} | |
&-input-filter { | |
// display: inline-block; | |
// border: 1px solid; | |
// @extend .input-group-addon ; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment