Last active
December 27, 2015 18:19
-
-
Save chilversc/7369380 to your computer and use it in GitHub Desktop.
Support multiple prefix/suffix addons in an input group using Twitter Bootstrap, http://jsfiddle.net/gh/gist/library/pure/7369380/
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
/* | |
if instead of | |
.input-group-addon:last-child { | |
border-left: 0; | |
} | |
this is used | |
.input-group-addon:last-child { | |
border-left-style: none; | |
} | |
*/ | |
.input-group-addon { | |
border-left: 1px none #ccc; | |
border-right: 1px none #ccc; | |
} | |
.input-group-addon:first-child { | |
border-left-style: solid; | |
} | |
.input-group-addon:last-child { | |
border-left-style: dotted; | |
border-right-style: solid; | |
} | |
.input-group-addon + .input-group-addon { | |
border-left-style: dotted; | |
} | |
/* no need to duplicate .has-success, .has-warning and .has-error. */ |
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
.input-group-addon { | |
border-left: 1px none #ccc; | |
border-right: 1px none #ccc; | |
} | |
.input-group-addon:first-child { | |
border-left-style: solid; | |
} | |
.input-group-addon:last-child { | |
border-left: 1px none #ccc; | |
border-right-style: solid; | |
} | |
.input-group-addon + .input-group-addon { | |
border-left-style: dotted; | |
} | |
/* This could be ommitted if the .input-group-addon:last-child did not set "border-left: 0". | |
Setting "border-left: 0" also resets the border-left-color to black */ | |
.has-success .input-group-addon:last-child { border-color: #468847; } | |
.has-warning .input-group-addon:last-child { border-color: #C09853; } | |
.has-error .input-group-addon:last-child { border-color: #B94A48; } | |
.row.space-xs { | |
margin-top: 4px; | |
margin-bottom: 4px; | |
} | |
.row.space-sm { | |
margin-top: 8px; | |
margin-bottom: 8px; | |
} | |
.row.space-md { | |
margin-top: 14px; | |
margin-bottom: 14px; | |
} | |
.row.space-lg { | |
margin-top: 24px; | |
margin-bottom: 24px; | |
} |
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 space-xs"> | |
<div class="col-md-4 col-sm-6"> | |
<div class="input-group"> | |
<span class="input-group-addon">A</span> | |
<span class="input-group-addon">B</span> | |
<span class="input-group-addon">C</span> | |
<input class="form-control"> | |
<span class="input-group-addon">X</span> | |
<span class="input-group-addon">Y</span> | |
<span class="input-group-addon">Z</span> | |
</div> | |
</div> | |
</div> | |
<div class="row space-xs"> | |
<div class="col-md-4 col-sm-6"> | |
<div class="input-group has-success"> | |
<span class="input-group-addon">A</span> | |
<span class="input-group-addon">B</span> | |
<span class="input-group-addon">C</span> | |
<input class="form-control"> | |
<span class="input-group-addon">X</span> | |
<span class="input-group-addon">Y</span> | |
<span class="input-group-addon">Z</span> | |
</div> | |
</div> | |
</div> | |
<div class="row space-xs"> | |
<div class="col-md-4 col-sm-6"> | |
<div class="input-group has-warning"> | |
<span class="input-group-addon">A</span> | |
<span class="input-group-addon">B</span> | |
<span class="input-group-addon">C</span> | |
<input class="form-control"> | |
<span class="input-group-addon">X</span> | |
<span class="input-group-addon">Y</span> | |
<span class="input-group-addon">Z</span> | |
</div> | |
</div> | |
</div> | |
<div class="row space-xs"> | |
<div class="col-md-4 col-sm-6"> | |
<div class="input-group has-error"> | |
<span class="input-group-addon">A</span> | |
<span class="input-group-addon">B</span> | |
<span class="input-group-addon">C</span> | |
<input class="form-control"> | |
<span class="input-group-addon">X</span> | |
<span class="input-group-addon">Y</span> | |
<span class="input-group-addon">Z</span> | |
</div> | |
</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
description: Support multiple prefix/suffix addons in an input group using Twitter Bootstrap | |
authors: | |
- Chris Chilvers | |
resources: | |
- //netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment