css3实现拟物风

题外话:拟物风确实挺好看的,虽然现在还不算流行,但是对于设计来说应该是个趋势吧。

首先先看一下效果(虽然效果还是有些生硬,仅供参考)

代码模块:其实主要运用到css3的box-shadow属性(友情链接:https://www.w3school.com.cn/cssref/pr_box-shadow.asp

<body>
      <div class="container">
        <div class="block">
          <div class="big"></div>
          <div class="small"></div>
        </div>
        <div class="circle">
          <div class="cir"></div>   
        </div>
      </div>
  </body>
<style>
        *{  
          margin:0;
          padding:0;
          box-sizing:border-box;  
        }
        .container{
            width: 100%;
            height: 800px;
            background: #EAEBF3;
        }
        .block{
            width: 100%;
            height: 300px;
            position: relative;
        }
        .big{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 78px;
            height: 78px;
            border-radius: 10px;
            background: #EAEBF3;
            box-shadow: 
            -5px 0px 10px 1px rgba(255, 255, 255,0.8),/*左*/
            0px -5px 10px 1px rgba(255, 255, 255,0.8),/*上*/
            5px 0px 10px 1px rgba(0, 0, 0,0.1),/*右*/
            0px 5px 10px 1px rgba(0, 0, 0,0.1);/*下*/
        }
        .small{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 50px;
            height: 50px;
            border-radius: 10px;
            background: #EAEBF3;
            box-shadow: 
            5px 0px 5px 2px rgba(0, 0, 0,0.1) inset,/*左*/
            0px 5px 5px 2px rgba(0, 0, 0,0.1) inset,/*上*/
            -5px 0px 5px 2px rgba(255, 255, 255,0.8) inset,/*右*/
            0px -5px 5px 2px rgba(255, 255, 255,0.8) inset;/*下*/
        } 
        .circle{
          width: 100%;
          height: 100px;
          position: relative;
        }
        .cir{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 80px;
            height: 80px;
            border-radius: 40px;
            background: #EAEBF3;
            box-shadow: 
            -5px 0px 10px 1px rgba(255, 255, 255,0.8),/*左*/
            0px -5px 10px 1px rgba(255, 255, 255,0.8),/*上*/
            5px 0px 10px 1px rgba(0, 0, 0,0.1),/*右*/
            0px 5px 10px 1px rgba(0, 0, 0,0.1);/*下*/
        }
    </style>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值