分享一组非常简约好看的CSS凹凸感按钮样式
HTML代码:(可以是图片,也可以用font图标,自己引入样式即可)
<div class="container">
<div class="box">
<div class="img">
<i class="xulgricon xulgricon_weixin"></i>
</div>
<p>微信</p>
</div>
<div class="box">
<div class="img">
<img src="weixin.png" />
</div>
<p>微信</p>
</div>
</div>
CSS样式:(按需修改)
*{
padding: 0;
margin: 0;
}
body{
width: 100%;
height: 100vh;
/*//弹性盒子布局方式*/
display: flex;
/*容器内元素居中*/
justify-content: center;
align-items:center ;
background: #efeeee;
}
.container{
width: 700px;
height: 600px;
display: flex;
justify-content: space-around;/*容器内元素之间环绕留有一定空间*/
align-items: center;
flex-wrap: wrap;
}
.container .box{
display: flex;
justify-content: space-around;
flex-direction: column;
align-items: center;
width: 100px;
height: 140px;
margin: 20px;
}
.container .box .img{
width:100px;
height: 100px;
box-shadow: 18px 18px 30px rgba(0,0,0,0.1),
-18px -18px 30px rgba(255,255,255,1);/*阴影*/
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
background: #efeeee;
transition: box-shadow .2s ease-out;/*内嵌投影值*/
position: relative;
}
.container .box .img img{
width: 60px;
transition: width .2s ease-out;
/*实现效果以及实现方向以及实现时间 ease-out代表过度效果*/
}
.container .box p{
color: slategray;
}
.container .box .img:hover{
box-shadow: 0 0 0 rgba(0,0,0,0.1),
0 0 0 rgba(255,255,255,1),
inset 18px 18px 30px rgba(0,0,0,0.1),
inset -18px -18px 30px rgba(255,255,255,1);
transition: box-shadow .2s ease-out;/*内嵌投影值*/
& img{
width: 58px;
transition: width .2s ease-out;
}
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容