html+css小练习1-吃豆豆

html+css小练习1-吃豆豆

index.html+css效果如下:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>吃豆豆</title>
		<style>
			body {
				margin: 0;
				background-color: black;
				}
			div {
				width: 200px;
				height: 200px;
				margin-left: 150px;
				margin-top: 150px;
				border-radius: 100px;/* 圆角 顺时针:左上,右上,右下,左下*/
				animation: peas 1s infinite;
			}
			@keyframes peas/* 豆豆 */{
				0% {
					box-shadow:
					    100px 0px 0px -80px green,
						250px 0px 0px -80px green,
						450px 0px 0px -80px green,
						600px 0px 0px -80px green;/* 阴影:水平 垂直 阴影模糊半径 阴影扩展大小*/
				}
				100% {
					box-shadow:
					    50px 0px 0px -80px green,
						200px 0px 0px -80px green,
						350px 0px 0px -80px green,
						500px 0px 0px -80px green;
				}
			}
			div:before,div:after {
				display: block;/* 转换为块元素 */
				content: "";/* 激活伪元素的必要元素 */
				width: 200px;
				height: 100px;
				background: yellow;
			}
			div:before {
				border-radius: 100px 100px 0 0;
				transform: rotate(-20deg);/* 逆时针 */
				animation: mouthtop 1s infinite;
			}
			div:after {
				border-radius: 0px 0px 100px 100px;
				transform: rotate(20deg);/* 顺时针 */
				animation: mouthbutton 1s infinite;/* 执行动画:名称,时间,无限循环 */
			}
			@keyframes mouthtop{/* css3动画关键帧 */
				0% {
					transform: rotate(0deg);
				}
				50%{
					transform: rotate(-20deg);
				}
				100%{
					transform: rotate(0deg);
				}
			}
			@keyframes mouthbutton{/* css3动画关键帧 */
				0% {
					transform: rotate(0deg);
				}
				50%{
					transform: rotate(20deg);
				}
				100%{
					transform: rotate(0deg);
				}
			}
		</style>
	</head>
	<body>
		<!-- 盒子标签,矩形区域 -->
		<div></div>
	</body>
</html>


 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

ronghua_yang

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

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

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

打赏作者

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

抵扣说明:

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

余额充值