简简单单机器人
·
复习CSS,敲一敲小demo
本文利用的CSS知识点有:
CSS伪元素子绝父相
然后似乎就没啥啦嘻嘻…
机器人骨架:
<div class="box">
<header></header>
<div class="rbody">
<div class="lfoot"></div>
<div class="rfoot"></div>
</div>
</div>
给咱们可爱的机器人穿上衣服:
* {
padding: 0;
margin: 0;
}
.box {
width: 400px;
height: 600px;
margin: 40px auto 0 auto;
/*解决margin重合问题*/
overflow: hidden;
}
header {
position: relative;
width: 200px;
height: 100px;
background-color: teal;
margin: 40px auto 0 auto;
/*脑壳设置*/
border-radius: 100px 100px 0 0;
}
header::before {
/* content必须要有,不论有没有值
伪元素为行内元素,要先转化成块级元素才可以设置宽高哈*/
content: "";
position: absolute;
bottom: 30px;
left: 50px;
width: 15px;
height: 15px;
background-color: #fff;
border-radius: 50%;
}
header::after {
content: "";
position: absolute;
bottom: 30px;
right: 50px;
width: 15px;
height: 15px;
background-color: #fff;
border-radius: 50%;
}
.rbody {
position: relative;
width: 200px;
height: 220px;
background-color: teal;
margin: 6px auto 0 auto;
}
.rbody::before {
position: absolute;
top: 20px;
left: -30px;
content: "";
width: 20px;
height: 140px;
background-color: teal;
border-radius: 10px;
}
.rbody::after {
position: absolute;
top: 20px;
right: -30px;
content: "";
width: 20px;
height: 140px;
background-color: teal;
border-radius: 10px;
}
.lfoot {
position: absolute;
bottom: -90px;
left: 45px;
width: 20px;
height: 90px;
background-color: teal;
border-radius: 0 0 10px 10px;
}
.rfoot {
position: absolute;
bottom: -90px;
right: 45px;
width: 20px;
height: 90px;
background-color: teal;
border-radius: 0 0 10px 10px;
}
机器人做好啦,让我们来康康效果吧

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐



所有评论(0)