首页 > 其他分享 >css3 box-shadow 浮雕风格按钮

css3 box-shadow 浮雕风格按钮

时间:2024-07-10 10:56:57浏览次数:10  
标签:css3 box color ruler 1px 5px 2px 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,color,ruler,1px,5px,2px,shadow
From: https://blog.csdn.net/hackchen/article/details/140200607

相关文章

  • Simple WPF: WPF自定义一个可以定义步长的SpinBox
    最新内容优先发布于个人博客:小虎技术分享站,随后逐步搬运到博客园。通过WPF的按钮、文本输入框实现了一个简单的SpinBox数字输入用户组件并可以通过数据绑定数值和步长。本文中介绍了通过Xaml代码实现自定义组件的布局,依赖属性的定义和使用等知识点。完整代码见Github组合Xaml......
  • CSS3伸缩盒模型之伸缩容器和伸缩项目、主轴、侧轴
    一、伸缩容器和伸缩项目 伸缩容器:设置了display:flex的元素,就是伸缩容器。  1.给元素设置:display:flex或display:inline-flex,该元素就变为了伸缩容器。  2.display:inline-flex很少使用,因为可以给多个伸缩容器的父容器,也设置为伸缩容器。  3.一个元......
  • mapboxgl加载geoserver发布的tms矢量图层服务
    mapboxgl加载geoserver发布的tms矢量图层服务//添加源g.map.addSource('tms-source',{type:'vector',scheme:'tms',tiles:['http://localhost:9090/geoserver/gwc/service/tms/1.0.0/route:global_port@EPSG:900913@pbf/{z}/{......
  • WPF ComboBox数据绑定:初始化动态加载ItemsSource后首次赋值Text不显示问题解决
    原来:<ComboBoxText="{BindingItem}"ItemsSource="{BindingItemLists}"></ComboBox>privatevoidParas_Init(){ItemLists=newObservableCollection<string>();ItemLists.Add("111......
  • [CISCN2019 华北赛区 Day1 Web1]Dropbox
    进入题目注册一个账号登录进去后上传一个文件发现只能上传图片下载删除时分别抓包发现在download.php里下载,在delete.php处删除发现filename参数,有任意文件下载漏洞下载download.php,delete.php目录遍历在delete.php里发现class.phpdb=$db;}publi......
  • Box,一个字典操作python库
     Box介绍Box是一个让字典操作变得异常简单与直观,支持通过属性访问字典内容的库。 特点概述属性访问Box允许用户像访问对象属性一样访问字典的值,提升了代码的可读性和易用性。无缝嵌套自动将嵌套的字典转换为Box对象,使得处理复杂字典结构变得轻而易举。灵活性......
  • 学懂C#编程:WPF应用开发系列——WPF之ComboBox控件的详细用法
    WPF(WindowsPresentationFoundation)中的ComboBox控件是一个下拉列表控件,允许用户从一组预定义的选项中选择一个选项。以下是ComboBox控件的详细用法,并附带示例说明。ComboBox的基本用法1.XAML定义:在XAML中定义一个ComboBox控件,并添加一些选项。<Windowx:Class="ComboBox......
  • qt 入门常用类理解(涉及QMessageBox,Layout,Spacers,Splitter,Buuddy,LoginApp,QFile,
    1.QMessageBoxQMessageBox::Yes QApplication::quit();QMessageBox::exec用于在模态(阻塞式)对话框中显示一个消息框,并等待用户的响应。这个函数通常用于在应用程序中显示消息、警告或询问对话框,并等待用户采取适当的操作后继续执行。int QMessageBox::exec()exec 函数没有......
  • css3 列表按先后顺序移动过来显示
    要实现列表按先后顺序平移过来,可以使用CSS动画结合:nth-child()选择器。以下是一个简单的示例:HTML:<ulclass="list"><li>Item1</li><li>Item2</li><li>Item3</li><li>Item4</li></ul>CSS:.listli{opacity:......
  • vagrant + vbox快速搭建虚拟机
    版本适配很重要vagrant :1.9.7 链接:https://pan.baidu.com/s/12J29q7aK02th9TmgIm6cpw 提取码:93mxvirtualbox:5.1.38 链接:https://pan.baidu.com/s/19ojU2284QvQXrAxyeRf8eA 提取码:b6jg1.先做一个boxvagrant box add centos7  CentOS-7-x86_64-Vagrant-1801_02.Virt......