所以我得到了这个css删除线动画(悬停时),但问题是我在两行不同的行上有文本,而删除线只在其中一个上设置动画(如图所示)。有没有办法让删除线在悬停时穿过两条线?
html
<a href="designer.html"><h1 class="option"><span>The</span><br><span>Designer</span></h1></a>
css
.options{
margin-top: 100px;
.option {
span {
cursor: pointer;
position: relative;
.strikethrough;
}
}
}
.strikethrough {
&::after, &::before {
content: '';
position: absolute;
width: 0%;
height: 5px;
top: 50%;
margin-top: -0.5px;
background: @accent_color;
}
&::before {
left: -2.5px;
}
&::after {
right: 2.5px;
background: @accent_color;
transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}
&:hover:before {
background: @accent_color;
width: 100%;
transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
&:hover:after {
background: transparent;
width: 100%;
transition: 0s;
}
}