I have the label like <label>name:<input></label>
and the css like
label:active{/*properties*/}
I’d like the properties to be applied to name inside <label> when I click on <input> it gets applied but it looses focus to the <input> soon after I click it.
here is an example: http://jsfiddle.net/GuCk4/2/
If I understand your question, you could just do this… without changing any HTML.Example: http://jsfiddle.net/jasongennaro/GuCk4/4/
BTW: you don’t really need
input:focushere… at least in my tests on Chrome. You may need it for other browsers.EDIT
Okay, after @Mohsen’s comment, I reread the question.
What you want is a parent selector in css. This does not exist. Since css relies on the cascade, it applies styles down the DOM not up it.
So, the only way to do what you want is to rewrite your HTML, as per @Mohsen’s answer, or use some jQuery, like so
Example 2: http://jsfiddle.net/jasongennaro/GuCk4/5/