CSS中的标志从底部到顶部的动画

huangapple go评论58阅读模式
英文:

Animation in CSS for logo that goes from bottom to top

问题

以下是您要翻译的部分:

"Hi i try to get animation on my index.html with my style.css but it does not work and i dont understood why.

Here's my code :

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=chrome">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles/style.css">
    <title>Arrow</title>
</head>

<body>
    <span><span><img src="img/Arrow_logo.png"></span></span>

    <div class="affiche">
        <img src="img/arrow-season-5-poster.jpg" width="34%">
    </div>

    <div class="navigation">
        <button><a href="pages/page2.html">Flash</a></button>
    </div>
</body>

</html>
body {
    background: #333;
}

.affiche {
    background-color: #333;
    color: #fff;
    text-align: center;
}

.navigation {
    background-color: #333;
    color: #666;
    text-align: center;
}

@keyframes spanFadeIn {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(0%);
    }
}

span {
    overflow: hidden;
    display: block;

    span {
        display: block;
        animation: spanFadeIn 500ms ease-in-out;
    }
}

I tried in sass but it broke everything in my html."

英文:

Hi i try to get animation on my index.html with my style.css but it does not work and i dont understood why.

Here's my code :

&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;

&lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=chrome&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles/style.css&quot;&gt;
    &lt;title&gt;Arrow&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;span&gt;&lt;span&gt;&lt;img src=&quot;img/Arrow_logo.png&quot;&gt;&lt;/span&gt;&lt;/span&gt;

    &lt;div class=&quot;affiche&quot;&gt;
        &lt;img src=&quot;img/arrow-season-5-poster.jpg&quot; width=&quot;34%&quot;&gt;
    &lt;/div&gt;

    &lt;div class=&quot;navigation&quot;&gt;
        &lt;button&gt;&lt;a href=&quot;pages/page2.html&quot;&gt;Flash&lt;/a&gt;&lt;/button&gt;
    &lt;/div&gt;
&lt;/body&gt;

&lt;/html&gt;
body {
    background: #333;
}

.affiche {
    background-color: #333;
    color: #fff;
    text-align: center;
}

.navigation {
    background-color: #333;
    color: #666;
    text-align: center;
}

@keyframes spanFadeIn {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(0%);
    }
}

span {
    overflow: hidden;
    display: block;

    span {
        display: block;
        animation: spanFadeIn 500ms ease-in-out;
    }
}

I tried in sass but it broke everything in my html.

答案1

得分: 0

你的CSS文件中使用了SASS代码(这是不正确的),而不是嵌套 spans,请使用以下标记:

body {
    background: #333;
}

.affiche {
    background-color: #333;
    color: #fff;
    text-align: center;
}

.navigation {
    background-color: #333;
    color: #666;
    text-align: center;
}

@keyframes spanFadeIn {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(0%);
    }
}

span {
    overflow: hidden;
    display: block;
}

span span {
    display: block;
    animation: spanFadeIn 500ms ease-in-out;
}
英文:

You are using SASS code in CSS file (which is incorrect), instead of nesting spans use the notation below:

body {
    background: #333;
}

.affiche {
    background-color: #333;
    color: #fff;
    text-align: center;
}

.navigation {
    background-color: #333;
    color: #666;
    text-align: center;
}

@keyframes spanFadeIn {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(0%);
    }
}

span {
    overflow: hidden;
    display: block;
}

span span {
    display: block;
    animation: spanFadeIn 500ms ease-in-out;
}

huangapple
  • 本文由 发表于 2023年3月21日 01:12:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75793326.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定