css3 使用box-shadow实现浮雕风格按钮效果
发布时间:2024-08-19 17:05:11 作者:hackchen
我要评论
这篇文章主要介绍了css3 使用box-shadow实现浮雕风格按钮效果,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧

利用 box-shadow 实现浮雕风格的按钮。
HTML:
<form>
<div class="segment">
<h1>Sign up</h1>
</div>
<label>
<input type="text" placeholder="Email Address" />
</label>
<label>
<input type="password" placeholder="Password" />
</label>
<button class="red" type="button"><i class="icon ion-md-lock"></i> Log in</button>
<div class="segment">
<button class="unit" type="button"><i class="icon ion-md-arrow-back"></i></button>
<button class="unit" type="button"><i class="icon ion-md-bookmark"></i></button>
<button class="unit" type="button"><i class="icon ion-md-settings"></i></button>
</div>
<div class="input-group">
<label>
<input type="text" placeholder="Email Address" />
</label>
<button class="unit" type="button"><i class="icon ion-md-search"></i></button>
</div>
</form>SCSS:
$ruler: 16px;
$color-red: #ae1100;
$color-bg: #ebecf0;
$color-shadow: #babecc;
$color-white: #fff;
body,
html {
background-color: $color-bg;
}
h1 {
margin: 0;
}
body,
p,
input,
select,
textarea,
button {
font-family: "Montserrat", sans-serif;
letter-spacing: -0.2px;
font-size: $ruler;
}
div,
p {
color: $color-shadow;
text-shadow: 1px 1px 1px $color-white;
}
form {
padding: $ruler;
width: $ruler * 20;
margin: 0 auto;
}
.segment {
padding: $ruler * 2 0;
text-align: center;
}
button,
input {
border: 0;
outline: 0;
font-size: $ruler;
border-radius: $ruler * 20;
padding: $ruler;
background-color: $color-bg;
text-shadow: 1px 1px 0 $color-white;
}
label {
display: block;
margin-bottom: $ruler * 1.5;
width: 100%;
}
input {
margin-right: $ruler/2;
box-shadow: inset 2px 2px 5px $color-shadow, inset -5px -5px 10px $color-white;
width: 100%;
box-sizing: border-box;
transition: all 0.2s ease-in-out;
appearance: none;
-webkit-appearance: none;
&:focus {
box-shadow: inset 1px 1px 2px $color-shadow,
inset -1px -1px 2px $color-white;
}
}
button {
color: #61677c;
font-weight: bold;
box-shadow: -5px -5px 20px $color-white, 5px 5px 20px $color-shadow;
transition: all 0.2s ease-in-out;
cursor: pointer;
font-weight: 600;
&:hover {
box-shadow: -2px -2px 5px $color-white, 2px 2px 5px $color-shadow;
}
&:active {
box-shadow: inset 1px 1px 2px $color-shadow,
inset -1px -1px 2px $color-white;
}
.icon {
margin-right: $ruler/2;
}
&.unit {
border-radius: $ruler/2;
line-height: 0;
width: $ruler * 3;
height: $ruler * 3;
display: inline-flex;
justify-content: center;
align-items: center;
margin: 0 $ruler/2;
font-size: $ruler * 1.2;
.icon {
margin-right: 0;
}
}
&.red {
display: block;
width: 100%;
color: $color-red;
}
}
.input-group {
display: flex;
align-items: center;
justify-content: flex-start;
label {
margin: 0;
flex: 1;
}
}到此这篇关于css3 box-shadow 浮雕风格按钮的文章就介绍到这了,更多相关css3 box-shadow浮雕按钮内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!
相关文章
CS3的Grid网格布局是目前最强的二维布局系统,可以同时对列和行进行处理,将网页划分成一个个网格,可以任意组合不同的网格,做出各种各样的布局,本文介绍CSS3 最强二维布局系2025-02-27- 本文介绍了如何使用CSS3的transform属性和动画技巧实现波浪式图片墙,通过设置图片的垂直偏移量,并使用动画使其周期性地改变位置,可以创建出动态且具有波浪效果的图片墙,同2025-02-27
文章介绍了如何使用CSS3实现一个雷达探测扫描的效果,包括夜色背景、蜘蛛网盘、扫描体的转动效果、尾巴阴影以及被扫描到的光点,通过HTML和CSS的配合,实现了丰富的动画效果,2025-02-21- CSS3的Flexbox是一种强大的布局模式,通过设置display:flex可以轻松实现对齐、排列和分布网页元素,它解决了传统布局方法中的对齐、间距分配和自适应布局等问题,接下来通过本2025-02-19
本文给大家介绍css3 实现icon刷新转动效果,文章开头给大家介绍了webkit-transform、animation、@keyframes这三个属性,结合实例代码给大家介绍的非常详细,感兴趣的朋友一2025-02-19- CSS3过渡属性用于实现元素从一种样式平滑过渡到另一种样式,通过设置transition-property过渡属性、transition-duration过渡时长transition-timing-function过渡函数和trans2025-02-19
- 本文介绍了如何使用CSS3创建一个简单的动态旋转加载样式,通过定义一个带有类名“loader”的HTML元素,并使用CSS样式和@keyframes规则来实现旋转动画,你可以根据需要调整样式2025-02-19
- 这篇文章主要介绍了如何使用CSS3的transition属性实现平滑的过渡动画,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧2025-02-13
本文介绍了使用CSS3中的Flexbox和Grid布局实现等高元素布局的方法,通过简单的两列实现、每行放置3列以及全部代码的展示,展示了这两种布局方式的实现细节和效果,感兴趣的朋2025-02-11- CSS3和SVG的结合使用为网页设计带来了创新的动态视觉效果,本文通过一个圆形进度条的动画特效示例,展示了如何利用CSS3的动画功能和SVG的矢量图形能力来创建丰富的用户交互体2024-10-24






最新评论