Есть много способов взглянуть на переход границы, я только что показал пару.
Источник
Есть свойство transition
, и оно принимает seconds
в качестве параметров, чтобы дать вам эффект.
#profile-content {
outline: solid 5px #FC5185;
transition: outline 0.6s linear;
margin: 0.5em;
}
#profile-content:hover {
outline-width: 10px;
}
<div id="profile-content">
Insert Content Here
</div>
ИЛИ
Div
пограничный переход:
div {
background: none;
border: 0;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
position: relative;
vertical-align: middle;
width: auto;
}
div::before,
div::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
#profile-content {
-webkit-transition: color 0.25s;
transition: color 0.25s;
}
#profile-content::before,
#profile-content::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
#profile-content::before {
top: 0;
left: 0;
}
#profile-content::after {
bottom: 0;
right: 0;
}
#profile-content:hover {
color: Teal;
}
#profile-content:hover::before,
#profile-content:hover::after {
width: 100%;
height: 100%;
}
#profile-content:hover::before {
border-top-color: black;
border-right-color: black;
-webkit-transition: width 1s ease-out, height 0.25s ease-out 0.25s;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
#profile-content:hover::after {
border-bottom-color: black;
border-left-color: black;
-webkit-transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
<div id="profile-content">
Insert Content Here
</div>