纯css实现多个表情变换效果
代码语言:html
所属分类:布局界面
代码描述:纯css实现多个表情变换效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { -webkit-box-align: center; align-items: center; font: 400 16px/1.2em sans-serif; display: -webkit-box; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; -webkit-box-pack: center; justify-content: center; min-height: 100vh; width: 100%; } body * { box-sizing: border-box; padding: 0; margin: 0; } .container { display: -webkit-box; display: flex; flex-wrap: wrap; -webkit-box-pack: center; justify-content: center; min-width: 320px; padding: 1em; width: 100%; } .emoji { -webkit-box-align: center; align-items: center; -webkit-animation-duration: 2s; animation-duration: 2s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-name: hover; animation-name: hover; -webkit-animation-timing-function: ease-in-out; animation-timing-function: ease-in-out; background: #ddd; border-radius: 1em; box-shadow: inset 0 0 0 0.25em rgba(34, 34, 34, 0.1); display: -webkit-box; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; height: 10em; margin: 1em; padding-top: 1.5em; position: relative; top: 0; width: 10em; } .emoji:after { -webkit-animation-duration: 2s; animation-duration: 2s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-name: shadow; animation-name: shadow; -webkit-animation-timing-function: ease-in-out; animation-timing-function: ease-in-out; background: rgba(34, 34, 34, 0.1); border-radius: 0.5em; bottom: -1em; content: ""; height: 0.5em; position: absolute; width: 80%; } @-webkit-keyframes shadow { from { background: rgba(34, 34, 34, 0.1); bottom: -1em; height: 0.5em; width: 80%; } 50% { background: rgba(34, 34, 34, 0.05); bottom: -2em; height: 0.35em; width: 65%; } to { background: rgba(34, 34, 34, 0.1); bottom: -1em; height: 0.5em; width: 80%; } } @keyframes shadow { from { background: rgba(34, 34, 34, 0.1); bottom: -1em; height: 0.5em; width: 80%; } 50% { background: rgba(34, 34, 34, 0.05); bottom: -2em; height: 0.35em; width: 65%; } to { background: rgba(34, 34, 34, 0.1); bottom: -1em; height: 0.5em; width: 80%; } } @-webkit-keyframes hover { from { top: 0; } 50% { top: -1em; } to { top: 0; } } @keyframes hover { from { top: 0; } 50% { top: -1em; } to { top: 0; } } .eyes { display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; width: 7.5em; } .eyes .eye { -webkit-box-align: center; align-items: center; background: #fff; border-radius: 50%; box-shadow: 0 0 0 0.25em rgba(34, 34, 34, 0.05); display: -webkit-box; display: flex; height: 3em; -webkit-box-pack: center; justify-content: center; overflow: hidden; position: relative; width: 3em; } .eyes .eye:after { background: #111; border-radius: 50%; content: ""; height: 1.5em; position: relative; width: 1.5em; } .cheeks { display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; width: 8.5em; } .cheeks .cheek { -webkit-box-align: center; align-items: center; background: radial-gradient(rgba(255, 192, 203, 0.75) 20%, rgba(255, 0, 0, 0) 70%); border-radius: 50%; display: -webkit-box; display: flex; height: 2.5em; -webkit-box-pack: center; justify-content: center; position: relative; width: 2.5em; } .smile { background: rgba(34, 34, 34, 0.35); border-radius: 0.25em; height: 0.5em; margin-top: 0.25em; width: 6em; } .emoji.blank { display: none; } .emoji.blank.active { display: -webkit-box; display: flex; } .emoji.happy { background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.65)), color-stop(20%, rgba(255, 255, 255, 0.25)), color-stop(50%, rgba(255, 255, 255, 0)), to(rgba(153, 0, 0, 0.2))) #ffcc00; background: linear-gradient(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.25) 20%, rgba(255, 255, 255, 0) 50%, rgba(153, 0, 0, 0.2)) #ffcc00; display: none; paddi.........完整代码请登录后点击上方下载按钮下载查看
网友评论0