html - CSS: Trigger styling for the sibling -
so have input field , button this:
<span class="btn-wrapper"> <input type="text" id="mytextfield"> <button type="submit" id="mysubmitbutton">go</button> </span>
what want is, when user focuses on mytextfield
, want add border both mytextfield
, mysubmitbutton
.
i have tried fails:
#mytextfield:focus + #mysubmitbutton{ border-color:solid 1px red; }
thanks
you have 2 problems:
- you using
border
shorthand syntaxborder-color
property - you need select both elements, not button.
such:
#mytextfield:focus, #mytextfield:focus + #mysubmitbutton{ border:solid 1px red; }
here's fiddle check out: http://jsfiddle.net/za4ew/
Comments
Post a Comment