css3头像,CSS3基础知识 - 绘制头像

CSS

语言:

CSSSCSS

确定

html {

font-size: 10px;

box-sizing: border-box;

position: relative;

}

*,

*:before,

*:after {

position: relative;

box-sizing: inherit;

}

html,

body {

height: 100%;

width: 100%;

background-color: ghostwhite;

}

body {

font-size: 1.618rem;

}

.skull {

position: absolute;

top: 50%;

left: 0;

right: 0;

transform: translateY(-50%);

width: 25rem;

height: 25rem;

margin: 0 auto;

overflow: hidden;

border-radius: 50%;

background-color: #e74c3c;

box-shadow: 0 0.5rem 0 0.25rem rgba(0, 0, 0, 0.15);

}

.skull:before {

content: "";

position: absolute;

display: block;

right: 0;

width: 50%;

height: 100%;

background-color: rgba(0, 0, 0, 0.15);

z-index: 10;

}

.skull .eyes {

position: absolute;

top: 38%;

transform: translateY(-38%);

left: 0;

right: 0;

}

.skull .eye {

position: absolute;

width: 3.75rem;

height: 4.9875rem;

background-color: #2b2b2b;

border-radius: 50%;

}

.skull .eye:first-child {

left: 25%;

transform: translateY(-40%) rotate(15deg);

}

.skull .eye:last-child {

right: 25%;

transform: translateY(-40%) rotate(-15deg);

}

.skull .nose,

.skull .nose:before,

.skull .nose:after {

width: 2rem;

height: 2rem;

position: relative;

background: #2b2b2b;

border-top-right-radius: 60%;

}

.skull .nose:before,

.skull .nose:after {

content: '';

position: absolute;

}

.skull .nose {

position: absolute;

left: 0;

right: 0;

bottom: 9rem;

margin: 0 auto;

transform: rotate(-60deg) skewX(-30deg) scale(1, 0.866);

}

.skull .nose:before {

transform: rotate(-135deg) skewX(-45deg) scale(1.414, 0.707) translate(0, -50%);

}

.skull .nose:after {

transform: rotate(135deg) skewY(-45deg) scale(0.707, 1.414) translate(50%);

}

.skull .teeth {

position: absolute;

width: 100%;

height: 6rem;

bottom: 0rem;

box-shadow: inset 0 0 0 7rem rgba(0, 0, 0, 0.15);

background-color: #2b2b2b;

}

.skull .teeth .top,

.skull .teeth .bottom {

width: 50%;

height: 3rem;

margin: 0 auto;

}

.skull .teeth .top .tooth {

border-radius: 50%;

}

.skull .teeth .bottom {

top: 1rem;

}

.skull .teeth .bottom .tooth {

border-radius: 50%;

}

.skull .teeth .tooth {

width: 25%;

height: 100%;

display: inline-block;

background-color: #e74c3c;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值