gpt4 book ai didi

html - 关键帧未显示所有元素

转载 作者:可可西里 更新时间:2023-11-01 13:18:33 25 4
gpt4 key购买 nike

我有一个包含 5 个元素的简单文本 slider ,不幸的是,幻灯片只显示了三个元素。

这是我的 jsfiddle:live demo

到目前为止,这是我的 HTML。

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="content">
<div class="slider-wrapper">
I can write
<div class="slider">
<div class="slider-text1">HTML</div>
<div class="slider-text2">Java</div>
<div class="slider-text3">PHP</div>
<div class="slider-text4">SOCIAL.</div>
<div class="slider-text5">LOUD.</div>
</div>
</div>
</div>
</body>

这是我的动画 CSS。

html,body {
margin: 0;
width: 100%;
height: 100%;
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
}
.content {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.slider-wrapper {
font-size: 40px;
color:#aaa;
font-weight: bold;
text-transform: uppercase;
display: flex;
align-items: center;
justify-content: center;
}
.slider{
height: 50px;
padding-left:15px;
overflow: hidden;
}
.slider div {
color:#fff;
height: 50px;
margin-bottom: 50px;
padding: 2px 15px;
text-align: center;
box-sizing: border-box;
}
.slider-text1 {
background: lightgreen;
animation: slide 3s linear infinite;
}
.slider-text2 {
background: skyblue;
}
.slider-text3 {
background: lightcoral;
}
.slider-text4 {
background: green;
}
.slider-text5 {
background: orange;
}
@keyframes slide {
0% {margin-top:-300px;}
5% {margin-top:-200px;}
33% {margin-top:-200px;}
38% {margin-top:-100px;}
66% {margin-top:-100px;}
71% {margin-top:0px;}
100% {margin-top:0px;}
}

我需要在我的代码中更改什么才能使所有元素都出现在我的 slider 中?任何帮助或建议将不胜感激。

最佳答案

html,body {
margin: 0;
width: 100%;
height: 100%;
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
}
.content {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.slider-wrapper {
font-size: 40px;
color:#aaa;
font-weight: bold;
text-transform: uppercase;
display: flex;
align-items: center;
justify-content: center;
}
.slider{
height: 50px;
padding-left:15px;
overflow: hidden;
}
.slider div {
color:#fff;
height: 50px;
margin-bottom: 50px;
padding: 2px 15px;
text-align: center;
box-sizing: border-box;
}
.slider-text1 {
background: lightgreen;
animation: slide 4s linear infinite;
}
.slider-text2 {
background: skyblue;
}
.slider-text3 {
background: lightcoral;
}
.slider-text4 {
background: green;
}
.slider-text5 {
background: orange;
}
@keyframes slide {
0% {margin-top:-500px;}
8% {margin-top:-500px;}
16% {margin-top:-400px;}
24% {margin-top:-400px;}
32% {margin-top:-300px;}
40% {margin-top:-300px;}
48% {margin-top:-200px;}
56% {margin-top:-200px;}
64% {margin-top:-100px;}
72% {margin-top:-100px;}
80% {margin-top:0px;}
88% {margin-top:0px;}

}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="content">
<div class="slider-wrapper">
I can write
<div class="slider">
<div class="slider-text1">HTML</div>
<div class="slider-text2">CdfddfSS</div>
<div class="slider-text3">PHP</div>
<div class="slider-text4">SOCIAL.</div>
<div class="slider-text5">LOUD.</div>
</div>
</div>
</div>
</body>

关于html - 关键帧未显示所有元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58061671/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com