今天分享一个用纯CSS实现的3D按钮。
css巧妙利用了box-shadow来实现3D物体的立体感,当按钮按下的时候再去修改box-shadow和top值。
让人感觉有一种按钮被按下的感觉。css代码非常少,如下所示:
|
a.css-3d-btn{
position:relative;
color: rgba(255,255,255,1);
text-decoration:none;
background-color: rgba(219,87,51,1);
font-family:"Microsoft YaHei", 微软雅黑, 宋体;
font-weight:700;
font-size:3em;
display:block;
padding:4px;
border-radius:8px;
/* let's use box shadows to make the button look more 3-dimensional */
box-shadow:0px9px0pxrgba(219,31,5,1),0px9px25pxrgba(0,0,0, .7);
margin:100pxauto;
width:160px;
text-align:center;
-webkit-transition:all.1s ease;
-moz-transition:all.1s ease;
transition:all.1s ease;
}
/* now if we make the box shadows smaller when the button is clicked, it'll look like the button has been "pushed" */
a.css-3d-btn:active{
box-shadow:0px3px0pxrgba(219,31,5,1),0px3px6pxrgba(0,0,0, .9);
position:relative;
top:6px;
}
|
效果如下:
创造与魔法九游版本
创造与魔法九游版采用了极致创新的魔幻游戏玩法感受,游戏具备最
疯狂医院达什医生中文版(Crazy Hospital)
疯狂医院达什医生最新版是一款医院模拟经营类游戏,逼真的场景画
宝宝庄园官方版
宝宝庄园官方版是一款超级经典好玩的模拟经营类型的手游,这个游
桃源记官方正版
桃源记是一款休闲娱乐类的水墨手绘风格打造的模拟经营手游。玩家
长途巴士模拟器手机版
长途巴士模拟器汉化版是一款十分比真好玩的大巴车模拟驾驶运营类