CSS3哆啦A梦代码
/* 定义样式 */ .doraemon { background-color: #1290c7; display: inline-block; position: relative; width: 100px; height: 100px; border-radius: 50%; border: 4px solid #fff; Box-shadow: inset 0 0 0 5px #f6af2f; } /* 添加半透明的白色小腰带 */ .doraemon:before { content: ''; position: absolute; top: 60px; left: 0; right: 0; margin: 0 auto; width: 60px; height: 10px; background-color: rgba(255,255,0.5); border-radius: 100%; z-index: 1; } /* 添加小腰带的扣子 */ .doraemon:after { content: ''; position: absolute; top: 62px; left: 0; right: 0; margin: 0 auto; width: 10px; height: 10px; background-color: #f00; border-radius: 50%; z-index: 2; } /* 添加脸部 */ .doraemon .face { position: absolute; left: 50%; top: 40%; width: 70px; height: 70px; margin-left: -35px; border: 2px solid #fff; border-radius: 50%; background-color: #fff; animation: face 4s infinite ease-in-out; } /* 添加脸部的眼睛 */ .doraemon .face .eyes { position: absolute; left: 50%; top: 50%; width: 60px; height: 17px; margin-top: -8.5px; margin-left: -30px; } /* 添加脸部的左眼 */ .doraemon .face .eyes .eye-left{ position: absolute; left: 0px; width: 20px; height: 17px; background-color: #000; border-radius: 50%; } /* 添加脸部的右眼 */ .doraemon .face .eyes .eye-right{ position: absolute; right: 0px; width: 20px; height: 17px; background-color: #000; border-radius: 50%; } /* 添加脸部的鼻子 */ .doraemon .face .nose { position: absolute; left: 50%; top: 50%; width: 13px; height: 13px; margin-left: -6.5px; margin-top: 10px; background-color: #f00; border-radius: 50%; } /* 添加脸部的嘴巴 */ .doraemon .face .mouth { position: absolute; left: 50%; top: 50%; width: 38px; height: 8px; margin-left: -19px; margin-top: 20px; border-bottom: 4px solid #000; border-radius: 0 0 50px 50px; transform: rotate(-45deg); } /* 定义动画 */ @keyframes face { 0%,20%,60%,100% { transform: translateY(0px); } 40% { transform: translateY(-10px); } 80% { transform: translateY(-5px); } }
以上就是CSS3哆啦A梦代码了,使用了众多的 CSS 属性,作出了一个可爱的哆啦A梦伙伴,如果你也想在自己的网页中加入一个可爱的哆啦A梦,不妨试试这段代码。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。