CSS——动画和弹性盒子(旋转相册,城市动画,WC3导航条,骰子(附源码))

本文通过两个实例——旋转相册和城市动画,介绍了HTML/CSS在创建动态效果方面的应用。在旋转相册中,利用transform属性实现了3D旋转效果,而在城市动画中,结合背景变化、弹性盒子和图片定位,营造出逼真的场景动画。这些实操练习有助于巩固和提升对HTML/CSS动画及布局的理解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

昨天,我简单的介绍了一下过渡和动画,这些主要是对一些属性的理解和运用,今天我们就来练练,实操检验成果,一起来看看吧!


前言

今天都是一些实操练习,有什么不清楚的可以发私信给我呀~内附源码,


一、旋转相册

1.运行效果

 代码如下(示例):

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>照片墙</title>
		<style>
			body {
				margin: 0px;
			}

			#div {
				background-image: url(w3.jpeg);
				position: fixed;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				min-width: 1000px;
				z-index: -10;
				zoom: 1;
				background-color: #fff;
				background-repeat: no-repeat;
				background-size: cover;
				background-position: center 0;

			}

			#photo_box {
				width: 280px;
				height: 400px;
				position: fixed;
				left: 0;
				right: 0;
				top: 0;
				bottom: 0;
				margin: 200px auto;
				transform-style: preserve-3d;
				transform: rotateX(-5deg) rotateY(0deg);
				animation: run 30s linear infinite;
			}

			#photo_box img {
				width: 250px;
				height: 350px;
				border: 5px solid #ccc;
				border-radius: 5px;
				position: absolute;
				left: 0;
				top: 0;
			}

			#photo_box img:nth-child(1) {
				transform: rotateY(0deg) translateZ(500px);
			}

			#photo_box img:nth-child(2) {
				transform: rotateY(60deg) translateZ(500px);
			}

			#photo_box img:nth-child(3) {
				transform: rotateY(120deg) translateZ(500px);
			}

			#photo_box img:nth-child(4) {
				transform: rotateY(180deg) translateZ(500px);
			}

			#photo_box img:nth-child(5) {
				transform: rotateY(240deg) translateZ(500px);
			}

			#photo_box img:nth-child(6) {
	
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

书棋06

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值