纯css实现瑞克和莫蒂任务形象效果代码
代码语言:html
所属分类:布局界面
代码描述:纯css实现瑞克和莫蒂任务形象效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300,700&display=swap'); :root { --border-color: #4f5352; --rick-skin-color: #ebe6e3; --morty-skin-color: #f1daca; --rick-hair-color: #bdcccf; --morty-hair-color: #a68564; --rick-spittle-color: #8bffc5; --rick-shirt-color: #d2eaea; --morty-shirt-color: #fffac0; --rick-hair-shape: polygon(15% 20%, 37% 32%, 49% 0%, 62% 32%, 83% 20%, 74% 43%, 89% 49%, 77% 62%, 88% 71%, 75% 77%, 82% 85%, 73% 84%, 73% 96%, 50% 86%, 25% 96%, 26% 84%, 17% 84%, 24% 77%, 10% 71%, 22% 62%, 9% 49%, 25% 42%); --custom-filter: drop-shadow(0 4px 0 var(--border-color)) drop-shadow(4px 0 0 var(--border-color)) drop-shadow(0 -4px 0 var(--border-color)) drop-shadow(-4px 0 0 var(--border-color)); --custom-filter-small: drop-shadow(0 2px 0 var(--border-color)) drop-shadow(2px 0 0 var(--border-color)) drop-shadow(0 -2px 0 var(--border-color)) drop-shadow(-2px 0 0 var(--border-color)); } .container { display: flex; justify-content: center; align-items: flex-end; flex-wrap: wrap; } .rick-container { width: 300px; } .rick-container .head-container { width: 100%; height: 300px; display: flex; justify-content: center; align-items: flex-end; position: relative; z-index: 2; } .rick-container .head-container .head { width: 38%; height: 60%; border: 4px solid var(--border-color); background: var(--rick-skin-color); border-radius: 80px; position: relative; z-index: 2; transform: translate(-2px, -15px); display: flex; justify-content: center; } .rick-container .head-container .head .brow-container { width: 90%; height: 25%; transform: translate(0, 8px); display: flex; align-items: flex-end; position: relative; z-index: 1; } .rick-container .head-container .head .brow-container .brow { width: 90%; height: 20%; background: var(--rick-hair-color); border-radius: 25px; border: 4px solid var(--border-color); display: flex; flex-direction: column; align-items: center; } .rick-container .head-container .head .brow-container .brow::before, .rick-container .head-container .head .brow-container .brow::after { position: absolute; content: ""; display: block; width: 80%; height: 4px; border-radius: 50px; background: var(--border-color); } .rick-container .head-container .head .brow-container .brow::before { width: 30%; transform: translate(0, -20px); } .rick-container .head-container .head .brow-container .brow::after { width: 65%; transform: translate(0, -12px); } .rick-container .head-container .head .eyes-container { position: absolute; width: 100%; height: 50px; transform: translate(0, 42px); display: flex; justify-content: space-around; } .rick-container .head-container .head .eyes-container .eye { width: 40px; height: 40px; border: 4px solid var(--border-color); border-radius: 50%; overflow: hidden; background: #fff; } .rick-container .head-container .head .eyes-container .eye::before { content: ""; display: block; width: 100%; height: 50%; background: var(--rick-skin-color); border-bottom: 4px solid var(--border-color); position: relative; z-index: 4; -webkit-animation: closeEyes 2s linear infinite alternate; animation: closeEyes 2s linear infinite alternate; } .rick-container .head-container .head .eyes-container .eye .pupil { content: ""; display: block; width: 5px; height: 12px; border-radius: 50%; background: var(--border-color); transform: translate(18px, -4px) rotate(25deg); position: relative; z-index: 1; } .rick-container .head-container .head .eyes-container .eye .pupil::before, .rick-container .head-container .head .eyes-container .eye .pupil::after { content: ""; display: block; width: 12px; height: 4px; position: absolute; border-radius: inherit; background: inherit; transform: translate(-3px, 3px) rotate(-30deg); } .rick-container .head-container .head .eyes-container .eye .pupil::after { transform: translate(-3px, 3px) rotate(30deg); } .rick-container .head-container .head .eyebags-container { position: absolute; width: 100%; height: 50px; transform: translate(0, 51px); display: flex; justify-content: space-around; } .rick-container .head-container .head .eyebags-container .eyebag { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--border-color); -webkit-clip-path: polygon(0 80%, 100% 80%, 100% 100%, 0 100%); clip-path: polygon(0 80%, 100% 80%, 100% 100%, 0 100%); } .rick-container .head-container .head .nose { position: absolute; border: 3px solid var(--border-color); width: 11px; height: 20px; border-top: 0; border-radius: 0 0 25px 25px; transform: translate(0, 90px); } .rick-container .head-container .head .mouth-container { position: absolute; width: 100%; height: 40px; transform: translate(0, 120px); display: flex; justify-content: center; } .rick-container .head-container .head .mouth-container .mouth { border-top: 3px solid var(--border-color); border-radius: 15px / 8px; width: 60%; position: relative; z-index: 2; } .rick-container .head-container .head .mouth-container .mouth::before, .rick-container .head-container .head .mouth-container .mouth::after { position: absolute; content: ""; display: block; border-bottom: 4px solid var(--border-color); width: 15px; height: 10px; border-radius: 50%; } .rick-container .head-container .head .mouth-container .mouth::before { transform: translate(-10px, -2px) rotate(85deg); } .rick-container .head-container .head .mouth-container .mouth::after { transform: translate(64px, -2px) rotate(-85deg); } .rick-container .head-container .head .mouth-container .spittle { position: absolute; z-index: 0; width: 30%; height: 15%; border-radius: 0 0 25px 25px; background: var(--rick-spittle-color); transform: translate(0, 2px); filter: var(--custom-filter-small); } .rick-container .head-container .head .mouth-container .spittle::after, .rick-container .head-container .head .mouth-container .spittle::before { position: absolute; content: ""; display: block; background: inherit; width: 10px; height: 24px; border-radius: inherit; } .rick-container .head-container .head .mouth-container .spittle::before { transform: translate(2px, 0); width: 26px; height: 10px; } .rick-container .head-container .head .mouth-container .spittle::after { transform: translate(14px, 0); } .rick-container .head-container .head .mouth-container .spittle-arcs { position: absolute; width: 40px; height: 40px; } .rick-container .head-container .head .mouth-container .spittle-arcs::before, .rick-container .head-container .head .mouth-container .spittle-arcs::after { position: absolute; content: ""; display: block; background: var(--rick-spittle-color); width: 4px; height: 4px; z-index: 5; border: 3px solid var(--border-color); border-radius: 40%; } .rick-container .head-container .head .mouth-container .spittle-arcs::before { height: 8px; transform: translate(-2px, 20px) rotate(-45deg); } .rick-container .head-container .head .mouth-container .spittle-arcs::after { transform: translate(40px, 20px); } .rick-container .head-container .ear-container { position: absolute; z-index: 1; display: flex; justify-content: space-between; width: 150px; height: 30px; transform: translate(-2px, -100px); } .rick-container .head-container .ear-container .ear { width: 20px; height: 30px; background: var(--rick-skin-color); border: 4px solid var(--border-color); border-radius: 25px; } .rick-container .head-container .hair-container { position: absolute; width: 100%; height: 100%; filter: var(--custom-filter); } .rick-container .head-container .hair-container .hair { width: 100%; height: 90%; background: var(--rick-hair-color); -webkit-clip-path: var(--rick-hair-shape); clip-path: var(--rick-hair-shape); } .rick-container .head-container .neck { position: absolute; width: 40px; height: 25px; border: 4px solid var(--border-color); border-radius: 0 0 15px 15px / 0 0 8px 8px; background: var(--rick-skin-color); } .rick-container .body-container { width: 100%; height: 150px; transform: translate(0, -12px); display: flex; justify-content: center; filter: var(--custom-filter); } .rick-container .body-container .body { width: 100%; height: 100%; background: #fff; -webkit-clip-path: polygon(20% 100%, 25% 25%, 50% 0, 75% 25%, 80% 100%); clip-path: polygon(20% 100%, 25% 25%, 50% 0, 75% 25%, 80% 100%); display: flex; justify-content: center; } .rick-container .body-container .body::before, .rick-container .body-container .body::after { content: ""; display: block; position: absolute; border-left: 4px solid var(--border-color); width: 5px; height: 80px; } .rick-container .body-container .body::after { transform: translate(-50px, 72px) rotate(4deg); } .rick-container .body-container .body::before { transform: translate(55px, 72px) rotate(-4deg); } .rick-container .body-container .body .shirt { width: 20%; height: 100%; background: var(--rick-shirt-color); border: 4px solid var(--border-color); border-radius: 30px 30px 0 0; border-top: 0; border-bottom: 0; } .rick-container .body-container .body .flaps-container { width: 200%; height: 100%; display: flex; justify-cont.........完整代码请登录后点击上方下载按钮下载查看
网友评论0