I am struggling to adjust the border width when my input box is focused. Currently, it has a 1px solid border which changes to a 2px different color solid border upon focus. However, this change in border width is causing the containing div to shift by 1px as well. As a beginner in HTML and CSS, I am seeking assistance to resolve this issue. Thank you for your help.
.contact-input {
border: 1px solid #707070;
border-radius: 10px;
margin-top: 1.5rem;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.16);
padding: 1.5rem;
}
.contact-label {
padding-bottom: 2rem;
}
.contact-input input[type="text"] {
outline: none;
border: none;
border-bottom: 1px solid #707070;
width: 40%;
}
.contact-input input[type="text"]:focus {
outline: none;
border-bottom: 2px solid #3AD6B1;
}
<div class="contact-input">
<div class="contact-label">Name</div>
<input class="w-50" type="text" placeholder="Your answer">
</div>