Problem with Keyframe within @media on wordpress

Asked

Viewed 33 times

1

Good morning

I’m finding the following difficulty in editing a mobile code in wordpress css, I made an animation with the keyframe on the desktop with the code below, but it’s time to put this same animation adapted for mobile. The problem is that when I put this block of code inside @media wordpress accuses error, already tried to remove it from @media and change the name of the class but without success. Thank you in advance. follows the images with the error shown inserir a descrição da imagem aqui inserir a descrição da imagem aqui

 #unidade-movel {
    position: absolute;
    left: 100%;
    top: 97px;
    animation: unidade-movel 10s infinite ;
}

@keyframes unidade-movel {
0% {
    top: 20px;
    left: 0%;
}

10% {
    top: 20px;
    left: 10%;
}
20% {
    top: 20px;
    left: 20%;
}
30% {
    top: 20px;
    left: 30%;
}
40% {
    top: 20px;
    left: 40%;
}
45% {
    top: 130px;
    left: 45%;
}
50% {
    top: 150px;
    left: 40%;
}
60% {
    top: 150px;
    left: 25%;
}
70% {
    top: 180px;
    left: 20%;
}
80% {
    top: 205px;
    left: 20%;
}
90% {
    top: 280px;
    left: 20%;
}
100% {
    top: 280px;
    left: 100%;
}
}

  • Dude I tested your code here, and the CSS part didn’t give any error... It worked perfectly... If you have an error try to ask the question which error you have presented. Or a link like the error, or the error message that appears etc... Something to help you answer

  • by kindness @hugocsl put two images in the question, I thank you already!

  • Your mistake is that one is missing } on line 558. That’s why you opened the @media ... 767px... { but it didn’t close } was missing these keys before starting @keyframes

  • 1

    I understood your tip, but I already did it this way, I already put the keyframe code after closing the media, I did a search before posting here that the media did not accept the keyframe inside it. When I do so it does not present error, but in this mode even I putting a drive-mobile-mobile keyframes does not recognize, when inspecting the code does not appear the mobile keyframe only from desk

  • 1

    From what I understand you have two animations one for mobile and another for desk, just change the Animation-name of the element within the @media you want with the name of the corresponding animation, so I understood from your comment.... If you are still in doubt Create another question, or edit this one, and put a simplified example and ask how you alternate @keyframes different depending on the size of the screen.... I give you a strength

  • 1

    @hugocsl sorry to bother you but that’s exactly what was happening, the name Animation was with the desk name. I made the switch and solved the problem! Problem solved, thanks again!

  • No problem, I’m glad you did. Another tip and whenever you ask here on the site try to give as much detail as possible, and always put all the code related to the problem, or the community will end up closing your question... Success ai, abs

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.