css ":focus" pseudo-class and selectors -


I'm struggling to get this right ... I basically have the following HTML setup:

  & lt; Div class = "box 10" & gt; & Lt; Span class = "label01" & gt; Name: & lt; / Span & gt; & Lt; Input class = "tboxes" type = "text box" /> & Lt; / Div & gt; "Span.label01" is an inline element, and the text box appears on the left side of "input.tboxes"  

I have tried the following CSS code :

  

Code> Input. Box: Focus span.label01 {color: # FF9900; ...}

But nothing happens. I know this is a CSS selector issue, but I can not get it right. I have also tried the adjacent brother selectors, and nothing else. Can anyone help me here? TIA!

Your selector is currently looking for a span inside the input. As far as I know, what you are trying to do with the current situation of CSS selector support is not really reliable.

I will try to do this with a little bit like jQuery such as:

  $ ("input.tboxes"). Focus (function {$ (this) .Parent ("div: first") .addClass ("focus"). ("Span") .addClass ("focus");});  

You should do this if you want to. If you set the style for .label01.focussed and .box10.focussed.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -