web前端学习11-css动画实例

web前端学习11-css动画实例

<html>
	<head>
		<meta charset="utf-8">
		<title>HTML动画过渡实例</title>
		<style type="text/css">
			.div{
				text-align: center;
			}
			.image{
				margin-top: 20px;
				width: 20%;
				height: 20%;
			}
			html:hover .image{/* 鼠标就如网页界面就会改变image */
				animation-name: img;/* 动画名称 */
				animation-delay: 100ms;/* 延迟时长 */
				animation-duration: 5s;/* 动画时长 */
				animation-fill-mode: forwards;/* 设置这个forwards,
				当鼠标不移出区域就会使动画停留在to阶段 */
			}
			@keyframes img{
				from{}
				to{
					margin-top: 0px;
					margin-bottom: 0px;
					padding:0px;
					width: 50%;
					height: 50%;
				}
			}
			
			.hero{
				font-family: "arial, helvetica, sans-serif";
				font-size: 40px;
				text-shadow: 1px 1px 5px red ;/* 水平偏移1px,垂直偏移1px,模糊程度2px,色值 */
				margin-top: 0px;
				opacity: 0;
			}
			html:hover .hero{
				transition-delay: 0.5s;/* 动画时长 */
				transition-duration: 0s;/* 延迟时间 */
				font-family: "arial, helvetica, sans-serif";
				font-size: 40px;
				text-shadow: 1px 1px 5px blue ;
				margin-top: 0px;
				opacity: 0.9;
			}
			html:
		</style>
	</head>
	<body>
		<div class="div">
			<img class="image" src="image/weizh.jpg"/>
			<p class="hero">英雄皮肤</p>
			<img class="image2" src="image/u=1340842496,1488220004&fm=26&gp=0.jpg"/>
		</div>
	</body>
</html>
文章仅供参考
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

修罗_

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

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

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

打赏作者

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

抵扣说明:

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

余额充值