Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Problem with input:focus within span

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #209295
    Tobau
    Participant

    Hi guys,

    I ran into a strange problem. I want to change the color of a label when the input field is set to :focus. Easy actually. But not when the input is wrapped with a span.

    I am pulling my hair. Any idea whats going on?

    http://codepen.io/tobau/pen/memMBB?editors=110

    #209300
    bearhead
    Participant

    It’s not working because when you wrap the input in a span, it is no longer adjacent to or a sibling with its label. If you put the label in the span with the input, it will work.

    #209301
    Tobau
    Participant

    Oh boy. Of course. My head just hit the table :) Thanks guys.


    @Paulie_D
    Its a contact form plugin, which I have to us. And they put the input in a span. Don’t ask me why.

    #209304
    Tobau
    Participant

    But this leads me to another question. How do I address the label when it has not the same parent.

    http://codepen.io/tobau/pen/memMBB?editors=110

    Even when I add a class to the label.

    #209305
    bearhead
    Participant

    Without wrapping both the input and label in the same span, I don’t think it is possible with just css.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.