CSS-Selector for multiple elements

前端 未结 2 1564
萌比男神i
萌比男神i 2020-12-12 02:01

I am not at all getting how to use more advanced css-selectors like + or > But as I am now needing it to prevent too much JS, maybe someone can help me out with this particu

2条回答
  •  独厮守ぢ
    2020-12-12 02:47

    You will need to target the input and the button separately. Because you want this to apply only when the input has focus, you will need to repeat the entire selector including the input:focus portion, then use a + combinator to link the button to the focused input:

    .rf_re1-suche_container input:focus,
    .rf_re1-suche_container input:focus + button {
        background: orange;
    }

提交回复
热议问题