最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
纯CSS实现3D按钮效果的实例解析
时间:2022-06-25 09:27:29 编辑:袖梨 来源:一聚教程网
今天分享一个用纯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;
}
|
效果如下:
相关文章
- 樱花动漫官网入口怎么找-樱花动漫官网入口直达 05-08
- 抖音创作者服务中心-平台登录入口2026 05-08
- 虚环手游是哪家公司开发的 虚环手游开发商及公司背景介绍 05-08
- 微博网页版如何调节字体大小 05-08
- 《Aliens: Fireteam Elite 2》宣布登陆PC PS5与Xbox Series X S平台 05-08
- 学信网官网入口在哪-学信网学籍查询通道 05-08
