css3实现底部阴影按钮

 时间:2026-02-15 10:28:05

1、新建html文档。

css3实现底部阴影按钮

2、书写hmtl代码。

<div class="page">

 <header id="header">

  <hgrounp class="blank">

  <h1></h1>

  <h2>

  <h2>

  </hgrounp>

 </header>

 <section class="demo">

  <div class="box">

   <div class="form-actions">

    <button type="button" class="btn">Click Me</button>

   </div>

  </div>

 </section>

</div>

css3实现底部阴影按钮

3、初始化css代码。

<style>

* { margin: 0; padding: 0 }

html { overflow-y: scroll }

body { background: #dcdcdc; }

.box { width: 550px; text-align: center; line-height: 46px; margin: 40px auto; }

</style>

css3实现底部阴影按钮

4、书写css代码。

.btn:nth-child(3n) { margin-right: 0; }

.btn:nth-child(1) { color: #8c3e4a; border-color: #ed7989; box-shadow: inset 0 1px 0 #f9a1b1, 0 1px 0 rgba(0,0,0,.2); background: -webkit-linear-gradient(top, #f78297, #f56c7e); background: -moz-linear-gradient(top, #f78297, #f56c7e); background: -o-linear-gradient(top, #f78297, #f56c7e); background: -ms-linear-gradient(top, #f78297, #f56c7e); background: linear-gradient(top, #f78297, #f56c7e); }

.btn:nth-child(1):hover { background: -webkit-linear-gradient(top, #fbacbb, #f4798f); background: -moz-linear-gradient(top, #fbacbb, #f4798f); background: -o-linear-gradient(top, #fbacbb, #f4798f); background: -ms-linear-gradient(top, #fbacbb, #f4798f); background: linear-gradient(top, #fbacbb, #f4798f); }

.btn:nth-child(1):active { top: 4px; box-shadow: inset 0 1px 3px #aa2c3d; background: -webkit-linear-gradient(top, #e15c6d, #e15c6d); background: -moz-linear-gradient(top, #e15c6d, #e15c6d); background: -o-linear-gradient(top, #e15c6d, #e15c6d); background: -ms-linear-gradient(top, #e15c6d, #e15c6d); background: linear-gradient(top, #e15c6d, #e15c6d); }

.btn:before, .btn:after { position: absolute; content: ""; height: 50%; border-radius: 50%; z-index: -1; }

.btn:before { width: 90%; left: 5%; top: 12%; box-shadow: 0 -7px 4px rgba(0,0,0,0.3); }

.btn:active:before { width: 90%; left: 5%; top: 12%; box-shadow: 0 0 2px rgba(0,0,0,0.3); }

.btn:after { width: 80%; left: 10%; bottom: 9%; box-shadow: 0 7px 4px rgba(0,0,0,0.4); }

.btn:active:after { width: 80%; left: 10%; bottom: 9%; box-shadow: 0 0 0 rgba(0,0,0,0.4); }

.box p:last-child { font-size: 20px; font-weight: bold; }

.box p:last-child span { color: #fff; }

css3实现底部阴影按钮

5、代码整体结构。

css3实现底部阴影按钮

6、查看效果。

css3实现底部阴影按钮

  • php 如何刷新一个div内容其他div不变
  • java指定范围内查找字符串忽略大小写
  • eclipse中如何使用frameset
  • 在人际交往中怎样才能认可别人?
  • 数据库安装数据库关系图
  • 热门搜索
    猪肝菠菜汤的做法 酱鸭的做法 红薯粉的做法大全 春笋的做法 河蚌肉的做法 庚怎么读 怎么判断得了尖湿锐尤 凉糕的做法 旖旎怎么读 猪肚莲子汤的做法