纯css 实现大白

image.png

首先是用html 语言来搭建框架

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Bymax</title>
    <link rel="stylesheet" href="dabai.css">
</head>
<body>
<div class="baymax">
<!-- 定义头部 -->
    <div class="head">
        <div class="eye"></div>
        <div class="eye2"></div>
        <div class="mouth"></div>
    </div>
    <!-- 定义驱干 -->
    <div class="torso">
        <div class="heart"> </div>
    </div>
    <!-- 心脏 -->
    <div class="belly">
        <div class="cover" =""></div>
    </div>
    <!-- 胳膊 -->
    <div class="left-arm">
        <div class="l-bigfinger"></div>
        <div class="l-smallfinger"></div>
    </div>

    <div class="right-arm">
        <div class="r-bigfinger" ></div>
        <div class="r-smallfinger"></div>
    </div>
    <!-- 腿 -->
    <div class="left-leg"></div>
    <div class="right-leg"></div>

</div>
</body>
</html>

如果你要构建一个页面,你首先要想好页面里面的内容有什么,它的组成,像画画一样一个一个去画
然后才是用css,排版出来,每一个css里面一般都是位置,大小,边框,效果,颜色。
如果你构建的是网站html 里面的html 标签就多,相对应的css ,就要考虑选择器,使用定义整体,再定义局部,我觉得对于一个网页来说,最重要的是在编码前对于页面整体的把握,之后去考虑细节的实现。如果以后我发现这一点不对,或者要补充,我会回来修改这篇博客。

css 来描绘图片样式:

body{
    background: red;
}
.baymax{
    margin: 200px auto 0px ;
    height: 500px;
    /*溢出部分隐藏*/
    overflow: hidden;

}
.head{
    height: 64px;
    width: 100px;
    border-radius: 50%;
    background: #fff;
    margin: 0 auto;
    margin-bottom: -20px;
    border-bottom: 5px solid #e0e0e0;
    z-index: 100;
    position: relative;
}
.eye,
.eye2{
    width: 11px;
    height: 13px;
    background: #282828;
    border-radius: 50px;
    position: relative;
    top: 30px;
    left: 27px;
    transform: rotate(8deg);
}


.eye2{
    transform: rotate(-8deg);
    left: 69px;
    top: 17px;
}
.mouth{
    width: 38px;
    height: 1.5px;
    background: #282828;
    position: relative;
    left: 34px;
    top: 10px;
}
.torso,.belly{
    margin: 0 auto;
    height: 200px;
    width: 180px;
    background: #fff;
    border-radius: 47%;
    border-bottom: 5px solid #e0e0e0;
    border-top: none;
    z-index: 1;
}
.belly{
    height: 300px;
    width: 245px;
    margin-top:-140px;
    z-index: 1;
}
.cover{
    width: 190px;
    background: #fff;
    height: 150px;
    margin: 0 auto;
    position: relative;
    top: -20px;
    border-radius: 50%;
}
.heart{
    width: 25px;
    height: 25px;
    border-radius: 50px ;
    position: relative;
    box-shadow: 2px 5px #ccc inset;
    right: -115px;
    top:40px;
    z-index: 111;
    border: 1px solid #ccc;

}
.left-arm,
.right-arm{
    height: 270px;
    width: 120px;
    border-radius: 50%;
    background: #fff;
    margin: 0 auto;
    position: relative;
    top: -350px;
    left: -100px;
    transform: rotate(20deg);
    z-index:-1;
}
.right-arm{
    transform: rotate(-20deg);
    left: 100px;
    top: -620px;
}

.l-bigfinger,
.r-bigfinger{
    height: 50px;
    width: 20px;
    border-radius: 50%;
    background: #fff;
    position: relative;
    top: 250px;
    left: 60px;
    transform:rotate(-50deg);
}
.r-bigfinger{
    background:#fff;
    transform:rotate(50deg);
    top: 248px;
    left: 40px;
}
.l-smallfinger,
.r-smallfinger{
    height: 35px;
    width: 15px;
    border-radius: 50%;
    background: #fff;
    position: relative;
    top: 195px;
    left: 76px;
    transform: rotate(-40deg);
}
.r-smallfinger{
    background: #fff;
    transform: rotate(40deg);
    top: 195px;
    left: 27px;
}
.left-leg,
.right-leg{
    height: 170px;
    width: 80px;
    border-radius: 30% 70%;
    background: #fff;
    position: relative;
    top: -640px;
    left:-50px;
    transform: rotate(-1deg);
    z-index: -2;
    margin: 0 auto;
}
.right-leg{
    border-radius: 70% 30%;
    margin: 0 auto;
    top: -810px;
    left: 45px ;
    transform: rotate(1deg);
}

转载于:https://www.cnblogs.com/rainbowbridge/p/11410335.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值