Why is this happening
You get this because of your transition and the initial value of your element. All elements have default values, even if they are not defined by you. For example, <div> elements always have display: block for each element by default and <b> have font-weight: bold by default.
Similarly, the <a> tag has border-bottom-color: rgb(0, 0, 0) . This is true even when the border thickness is zero.
In chrome, you can see all of this in the โCalculatedโ section of the โElementsโ tab:

So, when the transition begins, it gradually changes color from black to red, which you have identified.
How to fix
What you need to do is override the defaults with your own. This is to ensure that he does not start black.
a{ border-bottom: 2px solid transparent; transition: border-bottom 1s; } a:hover{ border-bottom: 2px solid red; }
The board should always define the same properties for the before-and-during element. Another thing you should be aware of is that using none , since the initial value will usually not give you the behavior you want. The transition requires a numerical value as the starting point (for example, 0 ).
Chris source share