Ok so I have an input field, #searchfield and it is contained within a wrapper, #seachbar. Is there a way I can select the wrapper when the input field is in focus? Or is this a job for javascript?
I would essentially like to do this but affect the #searchbar div instead of #searchfield:
No, parent selecting is the job of JavaScript, I’m afraid. (I think there’s been a long debate over whether CSS should include this … but it won’t happen any time soon. Maybe in CSS4!)
A parent selector has been drafted in the CSS4 spec, it’s still not clear what the final syntax will be but the W3C team have acknowledged the fact it is needed and will be working closely with browser vendors to get a working draft out soon.