gpt4 book ai didi

html - 通过 css 排列图像

转载 作者:行者123 更新时间:2023-11-28 01:58:44 25 4
gpt4 key购买 nike


My demo这些图像按此顺序出现,但我想按此顺序显示它们 (1-3-4-2)

我像在我的代码中一样使用顺序,但这不起作用,我如何使用 CSS没有 flex 来排序它们似乎把它们排成一排。另外,我怎样才能让它们旋转 x & y 不仅 z 显示为3d 旋转.

ul {
position: relative;
width: 100%;

}
#1 {order: 1;}
#2 {order: 4;}
#3 {order: 2;}
#4 {order: 3;}

li {
float: left;
width: 100%

}
#new{
width: 50%
}
img {
opacity: 0;
animation-name: fadeIn;
animation-duration: 3s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
li:nth-child(1) > img {
width: 20%;
margin-left:40%;
}
li:nth-child(2) > img {
width: 40%;
margin-left:20%;
animation-delay: 3s;
}

li:nth-child(3) > img {
width: 40%;
margin-left:40%;
animation-delay: 6s;
}

li:nth-child(4) > img {
width: 20%;
margin-left:40%;
animation-delay: 9s;
}


@keyframes fadeIn {
0% {
opacity: 0;
transform:rotateZ(0deg);


}

100% {
transform:rotateZ(360deg);
opacity: 1;
}
}
<!DOCTYPE html>
<html lang="en">

<head>

<title>Test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.css" rel="stylesheet"/>
<link rel="stylesheet" href="style.css">


</head>

<body>

<ul>
<li><img id="1" src="https://i.imgur.com/6WD0tuL.png" /></li>
<li id="new"><img id="2" src="https://i.imgur.com/6WD0tuL.png" /></li>
<li id="new"><img id="3" src="https://i.imgur.com/6WD0tuL.png" /></li>
<li><img id="4" src="https://i.imgur.com/6WD0tuL.png" /></li>

</ul>
</body>
</html>

最佳答案

您可以在您的 CSS 中调整动画延迟的时间以获得您想要的顺序。要将图像转换为 3D,您可以在 W3 3D Transforms 查看样本。 ;不过,如果您真的想让地球图像看起来像在 3D 中旋转,那么您可以使用 sprite 图像/gif。

ul {
position: relative;
width: 100%;
}
/*#1 {order: 1;}
#2 {order: 4;}
#3 {order: 2;}
#4 {order: 3;}*/

li {
float: left;
width: 100%;
}
#new {
width: 50%;
}
img {
opacity: 0;
animation-name: fadeIn;
animation-duration: 3s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
li:nth-child(1) > img {
width: 20%;
margin-left: 40%;
}
li:nth-child(2) > img {
width: 40%;
margin-left: 20%;
animation-delay: 6s;
}

li:nth-child(3) > img {
width: 40%;
margin-left: 40%;
animation-delay: 3s;
}

li:nth-child(4) > img {
width: 20%;
margin-left: 40%;
animation-delay: 9s;
}

@keyframes fadeIn {
0% {
opacity: 0;
transform: rotateZ(0deg);
}

100% {
transform: rotateZ(360deg);
opacity: 1;
}
}
<!DOCTYPE html>
<html lang="en">

<head>

<title>Test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.css" rel="stylesheet" />
<link rel="stylesheet" href="style.css">

</head>

<body>

<ul>
<li><img id="1" src="https://i.imgur.com/c117rlU.png" /></li>
<li id="new"><img id="2" src="https://i.imgur.com/c117rlU.png" /></li>
<li id="new"><img id="3" src="https://i.imgur.com/c117rlU.png" /></li>
<li><img id="4" src="https://i.imgur.com/c117rlU.png" /></li>

</ul>
</body>

</html>

关于html - 通过 css 排列图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49474940/

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