CSS Animation Issue

I can’t figure out what’s wrong with this animation, it’s just not working when I open the file

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bee Project</title>
    <link rel="stylesheet" href="./messageStylesheet.css">
</head>
<body>
    <main>
        <div class="bee">
            <div class="bee-head">
                <!--<div class="bee-antenna left"></div>
                <div class="bee-antenna right"></div>-->
            </div>
            <div class="bee-wing top"></div>
            <div class="bee-wing bottom"></div>
        </div>
    </main>
</body>
</html>
:root{
    --bee-stripe-one: #f2ed07;
    --bee-stripe-two: #38382c;
    --bee-head: #343629;
}
@keyframes flap{
    0%{
        transform: rotate(0deg);
    }
    50%{
        transform: rotate(45deg);
    }
    100%{
        transform: rotate(0deg);
    }
}
html{
    overflow: hidden;
    background-color: #472e6b;
}
.bee{
    background: linear-gradient(
        90deg,
        var(--bee-stripe-one, yellow) 0%,
        var(--bee-stripe-one, yellow) 10%,
        var(--bee-stripe-two, black) 10%,
        var(--bee-stripe-two, black) 20%,
        var(--bee-stripe-one, yellow) 20%,
        var(--bee-stripe-one, yellow) 30%,
        var(--bee-stripe-two, black) 30%,
        var(--bee-stripe-two, black) 40%,
        var(--bee-stripe-one, yellow) 40%,
        var(--bee-stripe-one, yellow) 50%,
        var(--bee-stripe-two, black) 50%,
        var(--bee-stripe-two, black) 60%,
        var(--bee-stripe-one, yellow) 60%,
        var(--bee-stripe-one, yellow) 70%,
        var(--bee-stripe-two, black) 70%,
        var(--bee-stripe-two, black) 80%,
        var(--bee-stripe-one, yellow) 80%,
        var(--bee-stripe-one, yellow) 90%,
        var(--bee-stripe-two, black) 90%,
        var(--bee-stripe-two, black) 100%
    );
    width: 250px;
    height: 200px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    margin: auto;
    position: absolute;
    top: 0px;
    bottom: 0px;
    right: 0px;
    left: 0px;
}
.bee-head{
    position: absolute;
    height: 110px;
    width: 85px;
    background-color: var(--bee-head, black);
    border-radius: 50%;
    left: -60px;
}
.bee-wing{
    width: 75px;
    height: 125px;
    background: linear-gradient(
        rgb(200, 201, 194),
        rgb(218, 219, 213)
    );
    opacity: 0.80;
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    animation: flap 5s linear 1s infinite;
}
.bee-wing.top{
  top: -50px;
  
}
.bee-wing.bottom{
  top: 120px;
}

What is happening? What is supposed to be happening? What debugging have you tried?

When the file opens nothing happens, It should rotate the wings 45 degrees. I’ve tried rewriting the @keyframes rule and rewriting the animation call.

I also validated it with https://jigsaw.w3.org/css-validator/validator and it found no errors

You’ve double checked filenames and relative paths?

Everything else is working as intended except the animation

I don’t know if it helps, but the animation appears to work for me when I paste it into CodePen:

That did help, thank you!
I needed to update Chrome lol

1 Like