@keyframes not working, I have tried everything i can think of

Brett-9511

for some reason, the @keyframes rule won't work for me can someone please tell me where I am going wrong.

the only fix I can think of is -webkit- but that doesn't seem to help at all.

.keyframe {
  height: 15px;
  width: 50px;
  background-color: red;
  -webkit-transition: width 4s;
}

.keyframe:hover {
  width: 250px;
}

@-webkit-keyframes keyframe {
  0% {
    -webkit-background-color: red;
  }
  50% {
    -webkit-background-color: yellow;
  }
  70% {
    -webkit-background-color: blue;
  }
  100% {
    -webkit-background-color: green;
  }
}
<div class="keyframe"></div>

I was expecting the colour to change as the bar progressed to the maximum width, however, the bar does not change colour at all.

Calvin Nunes

You need to specify the animation that will be called inside the :hover

also, add to the animation property the forwards key, to make it stop on the end of the animation (then it doesn't return to red). (I removed the -webkit from the CSS, because I don't think it is really necessary)

My tip also is to change the name of keyframe to something that specify what the animation do, like change-bgColor or similar.

.keyframe {
  height: 15px;
  width: 50px;
  background-color: red;
  -webkit-transition: width 4s;
}

.keyframe:hover {
  width: 250px;
  animation: change-bgColor 4s linear forwards;
}

@keyframes change-bgColor {
  0% {
    background-color: red;
  }
  50% {
    background-color: yellow;
  }
  70% {
    background-color: blue;
  }
  100% {
    background-color: green;
  }
}
<div class="keyframe"></div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I have annoying white space between iFrames - I have tried everything i can think of

Permission Denied CIFS. Tried everything I can think of

Learning web scraping - Selenium gives constant "NoSuchElementException" errors. I've tried everything I can think of

JQuery-mobile. Can't open the dialog programmatically; tried everything I could think of

No module named 'socks', i have tried everything

"Expecting ',' delimiter". Everything I've tried is not working

How can I click on the third element in this list using selenium? I have tried everything and nothing works

How can I get Log4j2 to log to my log file, I've tried everything I can think of, could it be a configuration issue in linux?

I have a problem with migration as I am new to Laravel. I have tried everything described on here with no success

I think i have done something that's setstate is not working in flutter

I am getting read property map of undefined.I have tried everything but nothing worked

SSH still asking for password even after I have tried everything (that I know of)

logout prevent back button java is not working i have tried all day but still can't get result,what am i missing?

Window.location not working I have tried eveything

javac is still not recognized, I tried everything

MethodNotAllowedHttpException appearing and I've tried everything

I can't get the webdriver to fill space with text, but i've tried everything on this website

My C# form flickers and I can't fix it. I've tried everything

Can I specify percentages in keyframes?

For loop in range output start from 0 to input i have tried everything

ValueError: invalid literal for int() with base 10: '' happened and i have tried everything to fix it

how to make flutter app check for data access, not just wifi or mobile connection, i have tried everything

Pygame image will not load. I have tried everything, ripping my hair out rn

How can I install more partitions, I have two I think swap and primary I guess?

I think MySqli select is not working?

i have checked all the indentations and i think everything is all good but my script is returning this error from my index.tsx file

I think i have a problem with the parenthesces

Can anyone see why I'm getting an "invalid hook" error? I have tried and tried and can't see what the problem is

How do I disable automatic screen locking in Xubuntu?i have tried many ways but still not working