ฉันพยายามจะทำให้มีการเชื่อมโยงไปยังที่ expands pseudo-ธาตุ ก่อน เมื่อเมาส์ชี้อยู่.
.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>