30个HTML+CSS前端开发案例(五)

news2024/9/21 2:50:16

30个HTML+CSS前端开发案例(21-25)

  • 本人说明
  • 全屏加载动画效果
    • 代码实现
    • 效果
  • 吃豆豆动画效果
    • 代码实现
    • 效果
  • 鼠标悬停3D翻转效果
    • 代码实现
    • 效果
  • 3D旋转木马效果
    • 代码实现
    • 效果
  • flex弹性布局-酷狗音乐播放列表
    • 代码实现
    • 效果
  • 资源包

本人说明

本专栏为记录博主的毕业设计而开创,感兴趣的码友可以持续关注本专栏,会定期更新相关内容,我的论文选题为——基于神经网络的智能学习系统,侧重于考研专业课的智能化学习,目前跟着B站上手一些前端实战项目,把之前忘掉的东西都捡起来。
本次的五个小案例,前四个侧重于动画特效的实现,大家在抖音上可能经常看到类似的效果图,今天我们就来学习一下这些特效是如何是实现的!

全屏加载动画效果

代码实现

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>全屏加载动画效果</title>
		<link rel="stylesheet" href="css/animate.min.css">
		<style type="text/css">
			body {
				margin: 0;
				padding: 0;
			}

			.container {
				width: 100%;
				/* 浏览器整个高度被分为100份,100vh即为整个页面高度 */
				height: 100vh;
				background-color: aqua;
				position: relative;
			}

			.box {
				width: 1080px;
				height: 540px;
				/* background-color: beige; */
				position: absolute;
				/* 设置水平居中效果 */
				left: 50%;
				margin-left: -540px;
				top: 50%;
				margin-top: -270px;
			}
			.box .item{
				float: left;
				margin: 10px;
				border-radius: 10px;
			}
			.item1{
				width: 250px;
				height: 520px;
				background-image: linear-gradient(to bottom,#fff,pink);
			}
			.item2,.item3{
				width: 380px;
				height: 250px;
				background-image: linear-gradient(to bottom,pink,#fff);
			}
			.item4,.item5,.item6{
				width: 250px;
				height: 250px;
				background-image: linear-gradient(to bottom,#fff,pink);
			}
		</style>
	</head>
	<body>
		<div class="container">
			<div class="box">
				<div class="item item1 animate__animated animate__backInDown">可是</div>
				<div class="item item2 animate__animated animate__backInLeft">遗憾的是。</div>
				<div class="item item3 animate__animated animate__backInRight">我们生活在</div>
				<div class="item item4 animate__animated animate__backInUp">两条平行直线</div>
				<div class="item item5 animate__animated animate__bounceIn">永远不会相交的</div>
				<div class="item item6 animate__animated animate__fadeInDown">世界里</div>
			</div>
		</div>
	</body>
</html>

效果

吃豆豆动画效果

代码实现

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>吃豆豆动画效果</title>
		<style type="text/css">
			body {
				margin: 0px;
				padding: 0px;
			}

			.eat-peas {
				width: 600px;
				height: 200px;
				/* background-color: antiquewhite; */
				margin: 150px auto 0;
				position: relative;
			}

			.eat-peas .head {
				width: 200px;
				height: 200px;
				/* border: 2px solid blue; */
				border-radius: 50%;
				/* 隐藏多余盒子部分 */
				overflow: hidden;
				position: relative;
				z-index: 2;
			}

			/* 利用伪元素构造盒子 */
			.eat-peas .head::before {
				content: "";
				display: block;
				width: 200px;
				height: 100px;
				background-color: tomato;
				/* 以盒子底部中心为轴向上旋转盒子 */
				transform-origin: bottom center;
				transform: rotate(0deg);
				/* 引入动画 */
				animation: rotate1 .4s ease infinite alternate;
			}

			.eat-peas .head::after {
				content: "";
				display: block;
				width: 200px;
				height: 100px;
				background-color: tomato;
				/* 以盒子顶部中心为轴向下旋转盒子 */
				transform-origin: top center;
				transform: rotate(0deg);
				/* 引入动画 */
				animation: rotate2 .4s ease infinite alternate;

			}

			@keyframes rotate1 {
				0% {
					transform: rotate(0deg);
				}

				100% {
					transform: rotate(-30deg);
				}
			}
			@keyframes rotate2 {
				0% {
					transform: rotate(0deg);
				}
				
				100% {
					transform: rotate(30deg);
				}
			}
			 /* 眼睛 */
			.eat-peas .eye{
				width: 20px;
				height: 20px;
				background-color: #000;
				border: 2px solid #fff;
				position: absolute;
				top: 20px;
				left: 80px;
				border-radius: 50%;
			}
			/* 豆豆 */
			.eat-peas .peas{
				width: 40px;
				height: 40px;
				background-color: tomato;
				border-radius: 50%;
				position: absolute;
				left: 120px;
				top: 50%;
				margin-top: -20px;
				box-shadow: 70px 0px 0px tomato,140px 0px 0px tomato,210px 0px 0px tomato,280px 0px 0px tomato,350px 0px 0px tomato;
				animation: move .8s ease infinite;
			}
			@keyframes move {
				0%{
					transform: translateX(0px);
				}
				100%{
					transform: translateX(-70px);
				}
			}
		</style>
	</head>
	<body>
		<div class="eat-peas">
			<div class="head">
				<div class="eye"></div>
			</div>
			<div class="peas"></div>
		</div>
	</body>
</html>

效果

鼠标悬停3D翻转效果

代码实现

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>鼠标悬停3D翻转效果</title>
		<style type="text/css">
			body,h3,p{
				margin: 0;
				padding: 0;
			}
			.scene{
				width: 400px;
				height: 400px;
				/* border: 2px solid red; */
				margin: 100px auto 0;
				/* 视距,决定了3D效果*/
				perspective: 800px;
			}
			.scene .box{
				width: 400px;
				height: 300px;
				/* background-color: yellow;*/
				/* 添加过渡动画 */
				transition: all ease 1s;
				position: relative;
				/* 令元素呈现3D效果 */
				transform-style: preserve-3d;
			}
			.scene .box:hover{
				transform: rotateY(-180deg);
			}
			.box .box-front{
				width: 400px;
				height: 300px;
				background-color: pink;
				position: absolute;
				left: 0;
				top: 0;
				/* 调高层级 */
				z-index: 2;
			}
			.box .box-mid{
				width: 400px;
				height: 300px;
				background-color: rgba(0, 0, 0, 0.5);
				position: absolute;
				left: 0;
				top: 0;
				transform: translateZ(-1px);
			}
			.box .box-back{
				width: 200px;
				height: 200px;
				background-color: skyblue;
				background-image: linear-gradient(to bottom right,pink,#fff,skyblue);
				position: absolute;
				left: 50%;
				margin-left: -100px;
				top: 50%;
				margin-top: -100px;
				transform: translateZ(-100px) rotateY(-180deg);
				font-size: 14px;
				line-height: 20px;
				box-sizing: border-box;
				border-radius: 10px;
			}
			.box .box-back h3{
				text-align: center;
				color: #000;
				font-weight: 400;
				font-size: 16px;
			}
			.box .box-back p{
				font-size: 13px;
				margin: 10px;
				font-weight: 200;
				line-height: 20px;
			}
		</style>
	</head>
	<body>
		<div class="scene">
			<div class="box">
				<div class="box-front">
					<img src="images/3d01.jpg" alt="">
				</div>
				<div class="box-mid"></div>
				<div class="box-back">
					<h3>每日一言</h3>
					<p>遗憾的是我们生活在两条平行直线永远不会相交的世界里。</p>
				</div>
			</div>
		</div>
	</body>
</html>

效果

3D旋转木马效果

代码实现

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>3D旋转木马效果</title>
		<style type="text/css">
			body{
				margin: 0;
				padding: 0;
				background-color: #000;
			}
			.scene{
				width: 600px;
				height: 300px;
				/* border: 2px solid red; */
				margin: 150px auto 0;
				/* 设置视距 */
				perspective: 800px;
			}
			.scene .box{
				width: 600px;
				height: 300px;
				/* background-color: yellow; */
				/* 设置动画 */
			    /* transition: all 1s ease; */
				position: relative;
				transform-style: preserve-3d;
				animation: rotate 5s ease infinite;
			}
			/* .scene:hover .box{
				transform: rotateY(-300deg);
			} */
			.scene .box .item{
				width: 200px;
				height: 200px;
				background-color: skyblue;
				position: absolute;
				bottom: 0;
				left: 50%;
				margin-left: -100px;
				/* transform: rotateY(calc(var(--i) * 40deg)) translateZ(300px); */
			}
			.box .item:nth-child(1){
				transform:  translateZ(300px);
			}
			.box .item:nth-child(2){
				transform: rotateY(40deg) translateZ(300px);
			}
			.box .item:nth-child(3){
				transform: rotateY(80deg) translateZ(300px);
			}
			.box .item:nth-child(4){
				transform: rotateY(120deg) translateZ(300px);
			}
			.box .item:nth-child(5){
				transform: rotateY(160deg) translateZ(300px);
			}
			.box .item:nth-child(6){
				transform: rotateY(200deg) translateZ(300px);
			}
			.box .item:nth-child(7){
				transform: rotateY(240deg) translateZ(300px);
			}
			.box .item:nth-child(8){
				transform: rotateY(280deg) translateZ(300px);
			}
			.box .item:nth-child(9){
				transform: rotateY(320deg) translateZ(300px);
			}
			.box:hover{
				animation-play-state: paused;
			}
			@keyframes rotate {
				0%{
					transform: rotateX(-10deg) rotateY(0deg);
				}
				100%{
					transform: rotateX(-10deg) rotateY(-360deg);
				}
			}
		</style>
	</head>
	<body>
		<div class="scene">
			<div class="box">
				<div class="item --i:0">
					<img src="images/gg1.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:1">
					<img src="images/gg2.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:2">
					<img src="images/gg3.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:3">
					<img src="images/gg4.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:4">
					<img src="images/gg4.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:5">
					<img src="images/gg1.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:6">
					<img src="images/gg1.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:7">
					<img src="images/gg1.jpg" alt="" width="200" height="200">
				</div>
				<div class="item --i:8">
					<img src="images/gg1.jpg" alt="" width="200" height="200">
				</div>
			</div>
		</div>
	</body>
</html>

效果

flex弹性布局-酷狗音乐播放列表

代码实现

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>flex弹性布局-酷狗音乐播放列表</title>
		<style type="text/css">
			body {
				margin: 0;
				padding: 0;
			}

			a {
				text-decoration: none;
			}

			.container {
				width: 100%;
				/* height: 600px; */
				/* background-color: antiquewhite; */
				/* 设置最小宽度,防止缩至过少造成挤压 */
				min-width: 680px;
				margin-top: 100px;
				/* 弹性布局 */
				display: flex;
				flex-wrap: wrap;
			}
			.container .item {
				width: 25%;
				display: flex;
				/* 调成内容居中显示 */
				justify-content: center;
				margin-bottom: 20px;
			}

			.container .item .item-con {
				width: 150px;
				/* border: 1px solid red; */
				/* 弹性布局方向设置为纵向 */
				display: flex;
				flex-direction: column;
			}

			.item-con a.item-con-img {
				height: 150px;
				/* background-color: antiquewhite; */
				position: relative;
			}

			.item-con a.item-con-img img {
				border-radius: 10px;
			}
			/* 下方文字 */
			.item a.item-con-img span {
				font-size: 14px;
				color: #fff;
				/* background-color: red; */
				display: flex;
				position: absolute;
				bottom: 10px;
				left: 10px;
				z-index: 2;
			}

			.item-con a.item-con-img span img {
				margin-right: 5px;
			}
			/* 图片半下方遮罩层 */
			.item-con a.item-con-img::after{
				content: '';
				width: 100%;
				height: 50%;
				/* 使用渐变色 */
				background-image: linear-gradient(to bottom,rgba(255,255,255,0),rgba(0,0,0,0.5));
				display: block;
				position: absolute;
				left: 0;
				bottom: 0;
				border-radius: 0px 0px 10px 10px;
			}
			.item-con a.item-con-title{
				font-size: 14px;
				color: #333;
				margin-top: 10px;
			}
			.item-con a.item-con-title:hover{
				color: tomato;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-01.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div>
			</div>
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-02.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div>
			</div>
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-03.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div>
			</div>
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-04.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div>
			</div>
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-05.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div>
			</div>
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-06.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div>
			</div>
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-07.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div>
			</div>
			<div class="item">
				<div class="item-con">
					<a href="" class="item-con-img">
						<img src="images/flex-08.jpg" alt="">
						<span>
							<img src="images/icon_play.png" alt="" width="14">
							2444.0万
						</span>
					</a>
					<a href="" class="item-con-title">
						催眠:Delta脑波音乐减压深度睡眠
					</a>
				</div></div>
		</div>
	</body>
</html>

效果

资源包

相关代码及其图片素材,持续更新中。。。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/343612.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

论文阅读 | Restormer: Efficient Transformer for High-Resolution Image Restoration

前言&#xff1a;CVPR2022oral 用transformer应用到low-level任务 Restormer: Efficient Transformer for High-Resolution Image Restoration 引言 low-level task 如deblurring\denoising\dehazing等任务多是基于CNN做的&#xff0c;这样的局限性有二&#xff1a; 第一是卷…

文献综述,参考文献引用

知网完成文献综述 点击已选&#xff1a; 点导出题录 点自定义&#xff0c;点摘要&#xff0c;点预览 复制到剪切板 参考文献如何在论文中标注引用 国内外研究综述 简单介绍主题和所用理论&#xff0c;用第一段写综述的总结。 【 ...作...在西方国家已经有...多年的历史&…

基于应力的拓扑优化的高效3D灵敏度分析代码(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

【FFMPEG源码分析】从ffplay源码摸清ffmpeg框架(三)

从ffplay源码分析这篇文章中可以知道int stream_component_open(VideoState *is, int stream_index)函数是创建和初始化decoder的入口。本篇文章从此入口看下ffmpeg中decoder的内部结构是什么样子。 同样先提出几个问题&#xff0c;带着问题梳理源码&#xff0c;效率贼快啊 ff…

Linux(Linux的连接使用)

连接Linux我们一般使用CRT或者Xshell工具进行连接使用。 如CRT使用SSH的方式 输出主机&#xff0c;账户&#xff0c;密码那些就可以连接上了。 Linux系统是一个文件型操作系统&#xff0c;有一句话说Linux的一切皆是文件。Linux系统的启动大致有下面几个步骤 Linux系统有7个运…

excel应用技巧:如何用函数制作简易抽奖动图

利用INDEX函数和随机整数函数RANDBETWEEN配合&#xff0c;在Excel中做一个简单的抽奖器&#xff0c;可以随机抽取姓名或者奖品。有兴趣的伙伴可以做出来试试&#xff0c;撞撞2023年好运气。每次年会大家最期待的就是抽奖环节。为了看看自己今年运气怎么样&#xff0c;会不会获奖…

中国版ChatGPT来了! 如何解读ChatGPT将带来的技术变革

最近这段时间&#xff0c;ChatGPT真的是太火了&#xff01;各平台都在铺天盖地式的宣传&#xff0c;相信在这么些天的宣传中&#xff0c;大家也对ChatGPT有了一个大概的了解&#xff0c;我们这边也就简单介绍一下。据ChatGPT自我介绍&#xff0c;它是一款预训练语言模型&#x…

ContextCapture Master 倾斜摄影测量实景三维建模技术

ContextCapture实景建模大师是一套无需人工干预&#xff0c;通过影像自动生成高分辨率的三维模型的软件解决方案。它集合了全球最先进数字影像处理、计算机虚拟现实以及计算机几何图形算法&#xff0c;在易用性、数据兼容性、运算性能、友好的人机交互及自由的硬件配置兼容性等…

Java设计模式-02工厂模式

为什么需要工厂模式&#xff0c;其作用什么&#xff1f;如何实现&#xff0c;代码演示解析优缺点。Q1:为什么需要工厂模式&#xff1f;工厂模式的作用(优点)是什么&#xff1f; 解耦。把对象的创建和使用的过程分开。就是Class A 想调用 Class B &#xff0c;那么A只是调用B的…

安装jdk8

目录标题一、下载地址&#xff08;一&#xff09;Linux下载&#xff08;二&#xff09;Win下载二、安装&#xff08;一&#xff09;Linux&#xff08;二&#xff09;Win三、卸载&#xff08;一&#xff09;Linux&#xff08;二&#xff09;Win一、下载地址 jdk8最新版 jdk8其他…

Tessent Mbist(5) 并行static Retention(静态保持)测试

本章描述当嵌入存储器被不同的memory BIST控制器所测试或者被不同的memory BIST controller steps按顺序进行测试时如何进行retention测试. 在跑PSRT(parallel static retention testing)之前,建议先跑BIST in HWDefault 或者 RunTimeProg 模式去保证有足够高的fault覆盖率;PSR…

iOS 奔溃EXC_BAD_ACCESS(KERN_INVALID_ADDRESS)分析

EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)是一种常见的iOS应用程序崩溃错误&#xff0c;可能有以下原因&#xff1a; 尝试访问已释放的对象&#xff1a;即使是一个引用计数为0的对象&#xff0c;尝试访问它将导致崩溃。 尝试访问不正确的内存地址&#xff1a;例如&#xff0c;尝…

SpringBoot+Vue实现养老智慧服务平台

文末获取源码 开发语言&#xff1a;Java 框架&#xff1a;springboot JDK版本&#xff1a;JDK1.8 服务器&#xff1a;tomcat7 数据库&#xff1a;mysql 5.7/8.0 数据库工具&#xff1a;Navicat11 开发软件&#xff1a;eclipse/myeclipse/idea Maven包&#xff1a;Maven3.3.9 浏…

高姿态下的面部表情识别系统

效果展示&#xff1a; python表情、性别识别面部表情识别 (FER) 在计算机安全、神经科学、心理学和工程学方面有大量应用。由于其非侵入性&#xff0c;它被认为是打击犯罪的有用技术。然而&#xff0c;FER 面临着几个挑战&#xff0c;其中最严重的是它在严重的头部姿势下的预测…

浅谈二维数组元素的地址

一维数组元素的地址大家都比较容易理解&#xff0c;但对于二维数组&#xff0c;就很容易搞混了.今天我又被这个问题给弄糊涂了&#xff0c;翻了翻老谭的书本&#xff0c;对这个问题有了更深的认识. 首先给出一个二维数组a&#xff0c;它的定义为: int a[3][4] {{1,3,5,7}, {9,…

同花顺2023届春招内推

同花顺2023届春招开始啦&#xff01; 同花顺是国内首家上市的互联网金融信息服务平台&#xff0c;如果你对互联网金融感兴趣&#xff0c;如果你有志向在人工智能方向发挥所长&#xff0c;如果你也是一个激情澎湃的小伙伴&#xff0c;欢迎加入我们&#xff01;岗位类别&#xf…

企业级信息系统开发学习笔记1.1 初探Spring——采用Spring配置文件管理Bean

文章目录零、本讲学习目标一、Web开发技术二、Spring框架&#xff08;一&#xff09;Spring官网&#xff08;二&#xff09;Spring框架优点&#xff08;三&#xff09;为什么要选择Spring&#xff1f;&#xff08;四&#xff09; Spring框架因何而来&#xff08;五&#xff09;…

寒假学习内容总结

1.html看视频过了一遍&#xff0c;没什么要学的。 2.CSS系统学习完了 全程做了详细的笔记 并复刻了几个网页页面 规范了自己的css代码书写方式 http://t.csdn.cn/VxOih css引入方式&#xff0c;字体&#xff0c; 文本水平对齐方式&#xff0c;选择器&#xff0c;快捷语法&…

解决Idea启动项目失败,提示Error running ‘XXXApplication‘: Command line is too long

IDEA版本为&#xff1a;IntelliJ IDEA 2018.2 (Ultimate Edition)一、问题描述有时当我们使用IDEA&#xff0c;Run/Debug一个SpringBoot项目时&#xff0c;可能会启动失败&#xff0c;并提示以下错误。Error running XXXApplication: Command line is too long. Shorten comman…

Transformer简介

Transformer: 总体架构 Transformer是“编码器—解码器”架构&#xff0c;由编码器(encoder)和解码器(decoder)组成&#xff0c;其都是多头自注意力模块的叠加。其中&#xff0c;input sequence分成两部分&#xff0c;分别为源(input)输入序列和目标(output)输出序列。前者输入…