- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试仅使用 CSS 而非 JS 创建横幅。如果我使用诸如 GreenSock 或 Create 之类的 JS 库来设置时间会更容易,但我不知道如何仅使用关键帧来完成。
我尝试设置元素的不透明度以显示下面的元素,但没有成功。
box-sizing: border-box;
margin: 0;
padding: 0;
}
.banner{
position: relative;
width: 100vw;
}
.first {
background-color: black;
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
width: 100vw;
height: 100vh;
}
@keyframes first {
0% {opacity: 0;}
50% {opacity: 1;}
100% {opacity: 0;}
}
.first img {
width: 90%;
position: absolute;
object-fit: contain;
top: 30%;
animation-name: first-screen;
animation-duration: 2s;
animation-timing-function: ease;
}
.bg {
width: 100vw;
height: 100vh;
margin-top: -10%;
overflow: hidden;
object-fit: cover;
object-position: center;
animation-name: bg;
animation-duration: 3s;
animation-delay: 2s;
}
@keyframes bg {
0% {opacity: 0;}
100% {opacity: 1;}
}
.offer{
display: flex;
width: 100vw;
object-fit: contain;
position: fixed;
bottom:0
}
.copy {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
width: 100vw;
height: 100vh;
animation-name: copy;
animation-duration: 3s;
animation-delay: 2s;
}
@keyframes copy {
0% {opacity: 0;}
50% {opacity: 1;}
100% {opacity: 0;}
}
.headline {
width: 70%;
position: absolute;
object-fit: contain;
top: 10%;
}
.subheadline {
width: 70%;
position: absolute;
object-fit: contain;
top: 22%;
}
我需要第一个屏幕淡入,该屏幕需要显示两秒然后淡出,然后背景会立即淡入并持续三秒钟,同时副本也会以不同的速度淡入。在这种情况下,除了背景之外,我的所有元素最终都显示在动画结束时。
这是 html:
<div class="first-screen"><img src="img/1st_frame.jpg"/></div>
<div class="copy">
<img src="img/headline.png" class="headline"/>
<img src="img/subheadline.png" class="subheadline" />
</div>
<img src="img/offer.png" class="offer" />
<img src="img/bg.jpg" class="bg"/>
最佳答案
我通过为所有动画设置相同的持续时间然后使用百分比来显示和隐藏元素来修复它,但仍然有一些元素应该同时显示和淡出并且具有不同的时间,即使 CSS关键帧和属性是相同的。 bg 和标题应该同时淡出,而不是只有标题淡出。有谁知道为什么吗?
html {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.interstitial {
position: relative;
width: 100vw;
}
.first {
background-color: black;
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
width: 100vw;
height: 100vh;
}
.first img {
width: 90%;
position: absolute;
object-fit: contain;
top: 30%;
animation-name: first-screen;
animation-duration: 5s;
animation-timing-function: ease-in;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
}
@keyframes first {
0% {
opacity: 0.5;
}
20% {
opacity: 1;
}
40% {
opacity: 0
}
100% {
opacity: 0;
}
}
.bg {
width: 100vw;
height: 100vh;
margin-top: -20%;
overflow: hidden;
object-fit: cover;
object-position: center;
animation-name: bg;
animation-duration: 5s;
animation-timing-function: ease;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
z-index: 0
}
@keyframes bg {
0% {
opacity: 0;
}
40% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.offer {
display: flex;
width: 100vw;
object-fit: contain;
position: fixed;
bottom: 0;
z-index: 999;
}
.copy {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
width: 100vw;
height: 100vh;
animation-name: headlines;
animation-duration: 5s;
animation-timing-function: ease;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
}
@keyframes headlines {
0% {
opacity: 0;
}
40% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.headline {
width: 70%;
position: absolute;
object-fit: contain;
top: 10%;
}
.subheadline {
width: 70%;
position: absolute;
object-fit: contain;
top: 22%;
}
关于css - 我如何只使用 CSS 为横幅制作动画,时间轴搞砸了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56401757/
目录 效果图 思路 具体实现 步骤一:ItemView顶部偏移 步骤二:绘制圆和线条 注意:下标的获取 流程类的绘制
我正在尝试构建一个时间轴,但是当我点击其中一个圆圈时我无法实现该功能事件的绿色条已完成,或者如果我点击前一个圆圈则“禁用”, 我的代码 CodePen 我尝试过的 Toggle var compl
我最近开始使用 JavaFx 2.0,也许我的问题很基本,但目前我不知道如何解决它。例如,假设我有一个名为 Clock 的小型演示应用程序: import javafx.animation.KeyFr
我需要创建一个基于自定义 HTML5 的控件,该控件是时间线和甘特图之间的交叉: 但是,我无法获得市场上已有的第三方控件来减少一些开发时间。它需要在顶部有微型缩小的时间轴以进行快速导航,滚动时会更新主
你好,我已经为 twitter 时间线编写了一个脚本,除了我不知道如何授权我的 twitter api key ,我的 led 标志只是说“错误的身份验证数据” 这是我的代码 #!/usr/bin/p
我正在使用 X 时间轴绘制一个非常规则的图表。轴代码非常标准: var xScale = d3.time.scale() .domain([tlState.startd
谁能帮我解释一下如何使用图形 api 发布带有照片(不是一张照片)的状态; 我尝试将照片添加到 me/photos 但我不需要查看以前帖子中的照片。 当我使用类似 TIMELINE_ALBUM/pho
我正在使用来自 here 的时间轴插件 这是我当前的代码: 1940s 1950s 1960s 1970s 1980s 1990s 2000s 1940's Ronald. 1950's
我有一些事件:有些是连续的,有些只是一天的事件。 我想在网页上精美地展示它们。有一堆日期选择器 jQuery 插件,但我找不到任何用于显示事件的插件。 可以是canvas,也可以是svg,也可以是cs
我正在尝试创建一个响应式时间轴,它的行为类似于 ( https://codepen.io/anon/pen/KoGdqG): 对于大于 600px 的宽度是水平的。每个部分的宽度是响应式的; 对于小于
在我复制并粘贴来自 https://mdbootstrap.com/plugins/jquery/timeline/#images 的代码之后,为什么图像看起来很大,我该怎么做才能使左侧和右侧的内容变
我想创建一个垂直的动态时间轴,左边是发生的时间,右边是发生的事情,中间有一条线,每个事件的线上都有一个气泡。时间、事件和事件数量将是动态的。 我在这里想的可能是垂直线的静态图像上的 RecyclerV
我正在尝试重新创建以下内容: 我有以下代码,其中包含它的要点,但不是确切的外观和感觉,我仍在尝试掌握 Swift 的 UI 方面。 VStack(spacing: 30) {
在使用下面的代码使用 AngularJS 生成时间线图表时,我遇到了一个问题。 基本上我无法找到导入时间线包的正确方法。就像下面导入 corechart 包一样,我如何导入时间线... google.
我正在尝试使用 javascript 或 jquery 在我的 Twitter 时间轴上动态设置 href 字段,我该如何执行此操作? Tweets by me 最佳答案 使用setAttribut
时间轴跟踪文件介绍如下: https://www.tensorflow.org/versions/r1.1/performance/xla/jit 这对于性能分析似乎很有用。但有一点我不明白。 1、“
我正在使用 d3 Timeline 插件 ( https://github.com/jiahuang/d3-timeline ),我终于得到了可视化可以读取我的数据的地方。但是,我现在需要使特定学生的
我正在尝试使用 Google 的时间轴创建一个图表来显示过去 7 天的事件,但我在缩放 x 轴时遇到了问题。 图表总是试图根据数据自动缩放,这破坏了我想要合并的一致性。我希望图表的右侧是今天的日期,左
获取多个 KML 文件(每个文件代表不同的日期)并创建带有 slider 的 Google map 的最佳方法是什么? 最佳答案 尝试http://code.google.com/p/timemap/
我一直在尝试为预定的事件构建一个网络显示。每个事件都有一个动态计算的宽度(基于事件持续时间)和 margin-left(基于开始时间)。每个事件也有一个高度,基于需要显示的内容。如果没有重叠事件将元素
我是一名优秀的程序员,十分优秀!