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:

  1. you using border shorthand syntax border-color property
  2. 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

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -