我在尝试做一个链接,扩大了伪元 之前, 在徘徊。
.open-link::before {
content: '•';
position: relative;
display: inline-block;
width: 10px;
transition: width .3s;
margin-right: 10px;
}
.open-link:hover::before {
content: '• • •';
width: 30px;
}
<a class="open-link" href="#">Link</a>
但是,过渡是不奇怪的,它看起来像点跳从底部。 怎么顺利,并使它看起来像他们从左边?
小提琴 https://jsfiddle.net/1u0tzxfg/
更新
这是一个好一点的过渡:
.open-link {
display: flex;
align-items: center;
text-decoration: none;
}
.open-link::before {
content: '• • •';
overflow: hidden;
width: 10px;
position: relative;
display: inline-block;
transition: all 0.3s ease;
margin-right: 10px;
white-space: nowrap;
}
.open-link:hover::before {
width: 50px;
}
<a class="open-link" href="#">Link</a>