I’m trying to translateX() a ‘dot’ under a text from one end to another, but just across the width of the text.
Here’s what I’ve tried, but it doesn’t work. Have you any solutions to that?
.wrapper ul li a::before{
display: block;
position: absolute;
content: "";
background-color: black;
height: 3px;
width: 3px;
bottom: 0;
left: 0;
transform: scale(0);
transition: transform 0.3s ease-out;
}
.wrapper ul li a:hover::before{
transform: scale(1);
-webkit-transform: translateX(100%);
-moz-transform: translateX(100%);
-ms-transform: translateX(100%);
-o-transform: translateX(100%);
transform: translateX(100%);
}
2
Answers
I've figured it out. I've used animation + @keyframes to transision the pseudo element. Here's how.
Make the parent div position relative to see the dot
You need to make a tag to position relative