Strikethrough
by Aashish Manandhar
HTML
<span id='someid'>Hello World</span>
CSS
@keyframes strikethrough{
0%{
width: 0%;
}
100%{
width:100%;
}
}
.strikethrough {
position: relative;
}
.strikethrough:after {
content: ' ';
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 1px;
background: black;
animation: strikethrough 3s linear 1 forwards;
}
JavaScript
let spanElement = document.getElementById('someid');
spanElement.addEventListener('click',()=>{
spanElement.className = 'strikethrough';
});