2020-12-26

博客介绍了CSS3和HTML相关的过渡案例以及综合动画内容,聚焦于信息技术领域中前端开发的动画实现,展现了CSS3和HTML在页面动态效果方面的应用。

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

CSS3
过渡的案例:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>过渡</title>
	<style type="text/css">
  body{
  
    	margin: 100px;
    }
div{

	width: 200px;
	height: 200px;
	border: 1px solid red;
	transition:background-color 2s,color 2s,border 2s,margin-left 2s;
}
div:hover{

	background-color: #888888;
	color: red;
	border: 1px solid green;
	margin-left: 50px;
	animation:myfirst 5s;
}
@keyframes myfirst
{
0%   {background: red; left:0px; top:0px;}
25%  {background: yellow; left:200px; top:0px;}
50%  {background: blue; left:200px; top:200px;}
75%  {background: green; left:0px; top:200px;}
100% {background: red; left:0px; top:0px;}
}



	</style>
</head>
<body>
<div>
</div>
</body>
</html>

综合动画:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
body{
	margin:100px; 
}
div{
width: 100px;
height: 100px;
border: 1px solid red;
transition:background-color 2s,color 2s,margin-left 2s,border 2s,transform 2s;

}
div:hover{

margin-left: 100px;
color: blue;
background-color: #ccc;
border: 1px solid green;
transform:rotateX(30deg) rotateY(30deg) translate(100px,100px);
animation:myfirst 5s;
}

@keyframes myfirst
{
0%   {background: red; left:0px; top:0px;}
25%  {background: yellow; left:200px; top:0px;}
50%  {background: blue; left:200px; top:200px;}
75%  {background: green; left:0px; top:200px;}
100% {background: red; left:0px; top:0px;}
}
	</style>
</head>
<body>
	<div>
	2
	</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值