css实现不同表情的电源插座效果代码
代码语言:html
所属分类:布局界面
代码描述:css实现不同表情的电源插座效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> *,*:before,*:after { border:0; box-sizing:border-box; margin:0; padding:0 } :root { font-size:calc(18px+(24 - 18) *(100vw - 320px)/(1920 - 320)) } body,input { background-color:#e0f0ff; font:1em "Oxygen",Helvetica,sans-serif; line-height:1.5 } form,fieldset,legend { background-color:inherit } form { margin:auto; max-width:24em; padding:1.5em .75em 0 } label { display:block } input { vertical-align:.125em } fieldset { box-shadow:0 0 0 .1em rgba(0,0,0,0.3); border-radius:.375em; display:inline-block; margin-bottom:1.5em; padding:.75em; width:100% } legend { font-weight:bold; padding:0 .25em } .outlet,.face { display:flex; justify-content:center; flex-wrap:wrap; align-content:center; align-items:center } .outlet { background-color:#edf1f4; border-radius:.375em; box-shadow:.0625em .0625em 0 rgba(0,0,0,0.1) inset,-0.0625em -0.0625em 0 rgba(0,0,0,0.2) inset,-0.5em -0.5em .5em rgba(0,0,0,0.3) inset,0.25em .25em .125em rgba(0,0,0,0.1) inset,-0.1875em 0 .1875em .6875em rgba(255,255,255,0.7) inset; flex-direction:column; margin:auto auto 1.5em; width:11em; height:18em } .face { border-radius:1.25em/50%; box-shadow:0 0 0 .125em #5c5858 inset,-0.125em -0.125em 0 .125em rgba(0,0,0,0.1) inset,0.125em .125em 0 .125em white inset; margin:.375em 0; width:5.5em; height:4.75em } .right-eye,.left-eye,.mouth { background:black; box-shadow:.0625em .0625em .0625em rgba(255,255,255,0.6); transition:all .3s linear } .right-eye,.left-eye { width:1.75em; height:2em } .right-eye { border-top:.375em solid rgba(255,255,255,0.75); border-right:.625em solid white; border-bottom:.375em solid #edf1f4; border-left:.75em solid rgba(255,255,255,0.8); border-radius:.375em 0 0 .375em/50% 0 0 50%; margin:.375em .1875em .1875em .375em; transform-origin:100% 0 } .left-eye { border-top:.5em solid rgba(255,255,255,0.75); border-right:.75em solid white; border-bottom:.5em solid #edf1f4; border-left:.625em solid rgba(255,255,255,0.9); border-radius:0 .375em .375em 0/0 50% 50% 0; margin:.375em .375em .1875em .1875em; transform-origin:0 0 } .mouth { border-top:.25em solid rgba(255,255,255,0.8); border-right:.25em solid #edf1f4; border-bottom:.25em solid #edf1f4; border-left:.25em solid rgba(255,255,255,0.8); border-radius:50% 50% 0 0; margin-top:.1875em; width:1.25em; height:1.25em } .screw { background-image:radial-gradient(0.25em .25em at 95% 50%,white,rgba(255,255,255,0)),linear-gradient(90deg,rgba(157,162,166,0) 40%,#9da2a6 41%,#9da2a6 59%,rgba(157,162,166,0) 60%),radial-gradient(at 50% 0,white,rgba(255,255,255,0)),radial-gradient(at 100% 75%,#9da2a6,rgba(157,162,166,0)); border-radius:50%; box-shadow:0 0 0 .0625em #9da2a6 inset; width:1.125em; height:1.125em } .happy div { animation:happy 2s .5s linear infinite } .happy .mouth { border-radius:0 0 50% 50% } .sad .right-eye { animation:sadRE 4s .5s linear infinite; transform:skewY(-25deg) scale(0.8,1) } .sad .left-eye { animation:sadLE 4s .5s linear infinite; transform:skewY(25deg) scale(0.8,1) } .sad .mouth { animation:sadM 4s .5s linear infinite; transform:scale(2,0.3) } .angry .right-eye { animation:angryRE 2s .5s linear infinite; transform:skewY(20deg) scale(0.8,1) } .angry .left-eye { animation:angryLE 2s .5s linear infinite; transform:skewY(-20deg) scale(0.8,1) } .angry .mouth { animation:angryM 2s .5s linear infinite; transform:scale(1.5,1) } .shocked .right-eye,.shocked .left-eye,.shocked .mouth { border-radius:50% } .shocked .right-eye,.shocked .left-eye { transform:scale(1.3,1.3) } .shocked .left-eye { animation:shockLE 2s .5s linear infinite } .shocked .mouth { transform:scale(1.2,1.2) } .laughing .right-eye,.laughing .left-eye { animation:laughE .4s .5s linear infinite; border-radius:50% 50% 0 0; transform:scale(1.2,1.1) } .laughing .mouth { animation:laughM .4s .5s linear infinite; border-radius:0 0 50% 50%; transform:scale(1.75,1.1); transform-origin:50% 100% } .sleeping .right-eye,.sleeping .left-eye { height:0; transform:scale(1.2,0.5) } .sleeping .mouth { animation:sleep 3s .5s linear infinite; border-radius:0; transform:scale(1.5,0.1) } @keyframes happy { from,10%,to { transform:translateY(0) } 5% { transform:translateY(-0.25em) } }@keyframes sadRE { from,10%,55%,65%,to { transform:translateY(0) skewY(-25deg) scale(0.8,1) } 5% { transform:translateY(0.125em) skewY(-25deg) scale(0.8,1) } 60% { transform:translateY(1em) skewY(-25deg) scale(0.8,0) } }@keyframes sadLE { from,10%,55%,65%,to { transform:translateY(0) .........完整代码请登录后点击上方下载按钮下载查看
网友评论0