Hello. There is an input to which a label is attached through for. How to contact him in the css? Through input:focus + label does not work.
Codepen: https://codepen.io/Alexxosipov/pen/rYLvYB
Code:
<div class="input_div"> <input type="text" id="promocode_input" name="promocode"><br> <label for="promocode_input">Введите промокод</label> </div> <style> @bluebtn: rgb(48,40,152); body { font-family: arial; } input { max-width: 220px; border: none; border-bottom: 1px solid lighten(@bluebtn, 30%); padding: 10px; display: block; float: left; margin: 15px auto 0; border-radius: 0; padding-left: 3px; width: 95%; outline: none; } .oute { margin: 30px auto; } .input_div { position: relative; display: block; label { position: absolute; top: 24px; transition: 0.25s; display: block; left: 3px; } input:focus + label { top: 10px; } } </style>