Reputation: 21
.form-field {
position: relative;
width: 370px;
height: 40px;
margin-left: 40px;
margin-bottom: 30px;
}
.label {
position: absolute;
margin-left: 42px;
margin-top: 12px;
width: 58px;
height: 16px;
font-size: 14px;
line-height: 16px;
letter-spacing: 0.01em;
color: #757575;
}
.connection-field {
padding-left: 42px;
width: 370px;
height: 40px;
border-radius: 4px;
border: 1px solid rgba(33, 33, 33, 0.2);
}
.connection-field:focus {
color: #2196f3;
border-color: 1px solid red;
}
<div class="form-field">
<label class="label" for="user_name">Имя</label>
<input class="connection-field" type="text" name="Имя"id="user_name">
<svg class="modal-icon-1">
<use xlink:href="#modal-icon-1"></use>
</svg>
</input>
</div>
The color of the input frame does not change when: focus ... border-color - does not change ... here I am writing something - because you see my code is not enough and you need to come up
Upvotes: 2
Views: 1401
Reputation: 36
--Just add outline: none and you're write border not border-color or write border-color: red .
.form-field {
position: relative;
width: 370px;
height: 40px;
margin-left: 40px;
margin-bottom: 30px;
}
.label {
position: absolute;
margin-left: 42px;
margin-top: 12px;
width: 58px;
height: 16px;
font-size: 14px;
line-height: 16px;
letter-spacing: 0.01em;
color: #757575;
}
.connection-field {
padding-left: 42px;
width: 370px;
height: 40px;
border-radius: 4px;
border: 1px solid rgba(33, 33, 33, 0.2);
outline: none; /*here add outline: none*/
}
.connection-field:focus {
color: #2196f3;
border: 1px solid red; /* here write border not border-color */
}
Upvotes: 1
Reputation: 2479
Here is the working solution:
.connection-field:focus {
outline: none;
color: #2196f3;
border:1px solid red;
}
Please check this CodePen link
Happy coding :)
Upvotes: 1
Reputation: 5869
add outline:none;
and border
for on focus. It will be works.
.form-field {
position: relative;
width: 370px;
height: 40px;
margin-left: 40px;
margin-bottom: 30px;
}
.label {
position: absolute;
margin-left: 42px;
margin-top: 12px;
width: 58px;
height: 16px;
font-size: 14px;
line-height: 16px;
letter-spacing: 0.01em;
color: #757575;
}
.connection-field {
padding-left: 42px;
width: 370px;
height: 40px;
border-radius: 4px;
border: 1px solid rgba(33, 33, 33, 0.2);
}
.connection-field:focus {
outline: none !important;
color: #2196f3;
border:1px solid red;
box-shadow: 0 0 10px #f00; /*--optional--*/
}
<div class="form-field">
<label class="label" for="user_name">Имя</label>
<input class="connection-field" type="text" name="Имя"id="user_name">
<svg class="modal-icon-1">
<use xlink:href="#modal-icon-1"></use>
</svg>
</input>
</div>
Please try to post your question in English not any other language.
Upvotes: 1