css - how to make the entire form (input and submit button) change border color on focus (bootstrap 3) -
i using bootstrap 3 , trying make entire form (input field , button), change border color on focus. meaning, if click in input field, entire border of button should change colors, not border of input field. make sense?
here code:
<form class="form-inline" role="form"> <div class="input-group"> <input class="form-control" type="text"> <span class="input-group-btn"> <button class="btn btn-default" type="button">search</button> </span> </div> </form> and css:
.form-control:focus { border-color:#1abc9c; box-shadow:none; } the problem ...it changes colors of input field, not button, unless clicks button. how make change colors both @ same time?
fiddle: http://jsfiddle.net/cbgpp/
use adjacent sibling selector css looks this:
.form-control:focus, .form-control:focus + span .btn{ border-color:#1abc9c; box-shadow:none; } it's supported in major browsers including ie7+.
here working: http://jsfiddle.net/cbgpp/2/
Comments
Post a Comment