效果图
练习代码
.face {
width: 600px;
height: 320px;
background: #FEE443;
position: relative;
}
.eye {
width: 60px;
height: 60px;
border-radius: 100%;
background: #222;
position: absolute;
}
.eye-l {
left: 105px;
top: 100px;
}
.eye-r {
right: 105px;
top: 100px;
}
.eye .bright {
width: 30px;
height: 30px;
position: absolute;
background: #fff;
border-radius: 50%;
}
.norse {
width: 0px;
height: 0px;
border: 18 px solid #000;
border-radius: 50%;
transform: translateX(-50%);
left: 50%;
top: 52%;
border-color: #000 #a9505000 transparent;
position: absolute;
}
.lip-l {
width: 50px;
height: 50px;
border: 4 px solid #000;
position: absolute;
background: red;
border-radius: 50%;
top: 66%;
left: 10%;
}
.lip-r {
width: 50px;
height: 50px;
border: 4 px solid #000;
position: absolute;
background: red;
border-radius: 50%;
top: 66%;
right: 10%;
}
.mouth {
overflow: hidden;
width: 150px;
height: 60px;
background: transparent;
position: absolute;
left: 50%;
bottom: 10%;
margin-left: -68px;
}
.mouth .a {
top: -30px;
position: absolute;
width: 60px;
height: 60px;
border: 6 px solid #222;
border-radius: 50%;
}
.mouth .b {
top: -30px;
position: absolute;
left: 65px;
width: 60px;
height: 60px;
border: 6 px solid #222;
border-radius: 50%;
}
html:
主要还是绝对定位还有圆角属性,比较基础,不喜勿喷。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析