Can I update the style of the parents after element when an input inside it is focused?
The design means I need to use an after element rather than styling the input with a border but i need to update the background colour of the after element when the input is focused. Can I do this just using SCSS / CSS?
HTML
<div class="subscribe__wrapper">
<div class="subscribe__input">
<input class="mr-medium" type="email" id="fields-emailAdress" required name="fields[email]"
placeholder="Your email address">
</div>
<button class="next btn-rounded btn-rounded--small ml-min">
</button>
</div>
SCSS
.subscribe__wrapper {
position: relative;
&:after {
content: '';
left: 0;
right: 0;
bottom: 0;
height: 2px;
background: $border-color;
position: absolute;
}
}
.subscribe__wrapper input:focus {
.subscribe__wrapper & {
&:after {
background: red;
}
}
}