0

I want to change property of sibling element when input is focused, but it doesn't work. What am I doing wrong?

.sibling {
  width: 100px;
  height: 100px;
  background-color: blue;
}

input:focus ~ .sibling {
  background-color: red;
}
<div class="sibling"></div>
<input type="text">

Thanks in advance!

Renato Maretić
  • 315
  • 1
  • 4
  • 18

1 Answers1

2

Just change your html order

<input type="text">
<div class="sibling"></div>