Hello! I want the underline in my header to be animated like the one on this site:
My store is: https://kitchencrafted.shop
Thank you in advance!
Hello! I want the underline in my header to be animated like the one on this site:
My store is: https://kitchencrafted.shop
Thank you in advance!
This requires a bit of css, the way that it works is that on hover, there is a pseudo element that getâs animated. If you inspect the dev tools site, you will see in the html :after
, this is the pseudo element that I am referring to. If you go to the link (the tag) you can force a hover state and then you can look at the styles.
You have to right click on where the yellow dot is and that is where you can select âforce-stateâ
Hello @kitchencrafted
Its Artzen Technologies! We will be happy to help you today.
For the desired result which you are seeking, you have to add the following css. The following CSS will make the menu links same as the one you are desiring on hover.
.header__menu-item:hover span{
text-decoration: none !important;
}
.header__menu-item span {
display: inline-block;
position: relative;
color: white;
}
.header__menu-item span span::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0;
left: 0;
background-color: white;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
.header__menu-item span:hover::after {
transform: scaleX(1);
transform-origin: bottom left;
}
This CSS will help you achieve the desired result. Please mark the solution as accepted if it helped you
Let me know if need further assistance
Regards,
Artzen Technologies
.header__menu-item:hover span{
text-decoration: none !important;
}
.header__menu-item span {
display: inline-block;
position: relative;
color: white;
}
.header__menu-item span span::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0;
left: 0;
background-color: white;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
.header__menu-item span:hover::after {
transform: scaleX(1);
transform-origin: bottom left;
}
This CSS will help you achieve the desired result. Please mark the solution as accepted if it helped you
Let me know if need further assistance
Regards,
Artzen Technologies
It works but when I try to save it, it says: âOnline Store editor session canât be publishedâ
Add this code in your css file. This will definitely work
It doesnât, thereâs no animation showing up
Which one youâve tried?
The code you sent earlier was working but it was saying: âOnline Store editor session canât be publishedâ , now I used the other developerâs code and it is not.. I canât seem to find the one you sent
Try now it may not show that error again.
.header__menu-item:hover span{
text-decoration: none !important;
}
.header__menu-item span{
display: inline-block;
position: relative;
}
.header__menu-item span::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0;
left: 0;
background-color: #fff;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
.header__menu-item span:hover::after {
text-decoration: none !important;
transform: scaleX(1);
transform-origin: bottom left;
}
Thanks! It worked
Hey where do you put the code? base.css? Not working for me using the dawn theme