div+css布局实现卡通男生人物形象代码
代码语言:html
所属分类:布局界面
代码描述:div+css布局实现卡通男生人物形象代码
代码标签: div css 布局 卡通 男生 人物 形象 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0; min-height: 100vh; display: grid; align-items: flex-end; justify-content: center; overflow: hidden; } article { --skin: #fca; --skin-dark: #ea8; --skin-dark-semi: #ea84; --skin-light: #fec; --hair: #963; --hair-dark: #741; --hair-light: #b85; --shirt: #9cf; font-size: 0.66vmin; width: 90em; aspect-ratio: 1; position: relative; & *, & *::before, & *::after { position: absolute; box-sizing: border-box; } } .body { width: 100%; height: 40%; bottom: 0; .chest { bottom: 0; left: 50%; transform: translate(-50%); width: 90%; height: 73%; background: var(--skin); border-radius: 50% / 125% 125% 0 0; background: radial-gradient(110% 120% at 50% 0, var(--skin) 12%, var(--skin-dark) 25%); } .shirt { bottom: 0; left: 50%; transform: translate(-50%); width: 91%; height: 74%; background: var(--shirt); border-radius: 50% / 125% 125% 0 0; mask: radial-gradient(80% 120% at 50% 0, #0000 20%, #000 0); &::before { content: ""; width: 39%; height: 33%; background: red; border-radius: 50% / 0 0 100% 100%; left: 50%; transform: translate(-50%); box-shadow: inset 0 0 0 100vmax #0001; filter: drop-shadow(-0.2em 0 0.1em #0002) drop-shadow(0.1em 0.1em 0.2em #fff2) drop-shadow(0.1em 0.2em 0.3em #fff4); background: repeating-conic-gradient(at 50% -65%, #0000 0 5deg, #0002 0 5.5deg, #fff4 6.5deg), var(--shirt); } } } .head { width: 50%; height: 60%; left: 50%; transform: translate(-50%); .hair { --b: ; --hair-light2: var(--hair-light); width: 20%; aspect-ratio: 1; border-radius: 50%; background: var(--b) radial-gradient(at 30% 30%, var(--hair-light) 10%, #0000 50%), var(--hair); transform: translate(-50%, -50%); box-shadow: inset 0 0 1em 0.25em var(--hair), inset -1em -1em 2em var(--hair-dark), inset 1em 1em 1em 0.25em var(--hair-light2) ; &.hair-1 { left: 50%; top: 5%; width: 25%; } &.hair-2 { left: 33%; top: 2%; --b: radial-gradient(100% 100% at 95% 65%, var(--hair-dark) 05%, #0000 50%), } &.hair-3 { --hair-light: #b85; --hair-light2: #0000; width: 21%; left: 66%; top: 3%; --b: radial-gradient(110% 120% at 10% 55%, var(--hair-dark) 0%, #0000 40%), } &.hair-5 { --hair-light: #b856; width: 24%; left: 46%; top: -3%; --b: radial-gradient(100% 100% at 60% 60%, var(--hair-dark) 0%, #0000 50%) , radial-gradient(100% 100% at 10% 40%, var(--hair-dark) 0, #0000 30%), } &.hair-4 { --hair-light: #b855; width: 17%; left: 63%; top: -3%; --b: radial-gradient(100% 100% at 10% 60%, var(--hair-dark) 5%, #0000 50%), } &.hair-6 { --hair-light: #b85c; left: 21%; top: 8%; --b: radial-gradient(120% 200% at 80% 10%, var(--hair-dark) 0%, #0000 30%),; } &.hair-7 { --hair-light: #b858; width: 22%; left: 11%; top: 18%; --b: radial-gradient(200% 150% at 80% 10%, var(--hair-dark) 5%, #0000 30%),; } &.hair-8 { --hair-light: #b858; left: 4%; top: 31%; width: 18%; --b: radial-gradient(200% 150% at 80% -10%, var(--hair-dark) 15%, #0000 30%),; } &.hair-9 { --hair-light: #b85c; left: 5%; top: 45%; height: 23%; --b: radial-gradient(at 30% 0, var(--hair-dark) 15%, #0000 30%),; } &.hair-6b { --hair-light: #b855; left: 77%; width: 25%; --b: radial-gradient(120% 200% at 20% 10%, var(--hair-dark) 10%, #0000 30%),;} &.hair-7b { --hair-light: #b854; left: 89%; --b: radial-gradient(200% 150% at 20% 10%, var(--hair-dark) 5%, #0000 30%),radial-gradient(200% 150% at 30% 90%, var(--hair-dark) 5%, #0000 30%),;} &.hair-8b { --hair-light: #b854; left: 94%; --b: radial-gradient(150% 250% at 30% 40%, var(--hair-dark) 5%, #0000 .........完整代码请登录后点击上方下载按钮下载查看
网友评论0