How To Color Input Border Bottom Using Css
I need to color a input border bottom when the input is not focus. This is my html code:
Solution 1:
The border is red in your example:
.numero {
border-bottom: 1px solid #F00;
}
<inputtype="number"id="nc"name="days"class="numero"placeholder=""min="0"><br />
Simply use the shorthand to add a style, size and color and it works.
Now, in order to remove this when it is focused:
.numero:not(:focus) {
border-bottom: 1px solid #F00;
}
<inputtype="number"id="nc"name="days"class="numero"placeholder=""min="0"><br />
We use the :not()
functionality with the :focus
to check if the element in question is not focused.
Solution 2:
Solution 3:
Add some border style:
.numero{
border: 1px, solid;
border-bottom-color: red;
}
Solution 4:
You should define the border thickness in the css. You can write that like this
.numero {
border-bottom:1px solid red;
}
And on focus if you want another color you can like this
.numero:focus {
border-bottom:1px solid transparent;
}
You can change the value of transparent to any other color of your preference.
Solution 5:
.numero {
border-bottom: 2px solid cyan;
}
<inputtype="number"id="nc"name="days"class="numero"placeholder=""min="0"><br />
for any query please comment. All the best
Post a Comment for "How To Color Input Border Bottom Using Css"