clickcss部分:.niceButton2{ position: relative; background-color: rgb(32, 93, 224); border: none; font-size: 28px; _css按钮样式">
当前位置:   article > 正文

几个实用又好看的纯css 按钮样式_css按钮样式

css按钮样式

分享几个实用又好看的纯css 按钮样式

水波纹扩散效果按钮(推荐)

html部分

<div class="button">
	<span>click me</span>
</div>
  • 1
  • 2
  • 3

css部分

  .button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 279rpx;
    height: 80rpx;
    padding: 24rpx;
    overflow: hidden;
    font-weight: 700;
    font-size: 26rpx;
    text-align: center;
    border-radius: 65rpx;
    &::after {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background-image: radial-gradient(circle, #ccc 10%, transparent 10.1%);
      transform: scale(10);
      opacity: 0;
      transition: all 0.45s;
      content: '';
    }

    &:active::after {
      transform: scale(0);
      opacity: 0.5;
      transition: 0s;
    }
  }
  .chat-now {
    color: #222;
    border: 1px solid #222;
  }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

横向波纹效果的按钮

html部分:

<button class="niceButton2">click</button>
  • 1

css部分:

.niceButton2{
            position: relative;
            background-color: rgb(32, 93, 224);
            border: none;
            font-size: 28px;
            color: #ffffff;
            padding: 20px;
            width: 200px;
            text-align: center;
            transition-duration: 0.6s;
            text-decoration: none;
            overflow: hidden;
            cursor: pointer;
        }
        .niceButton2::after{
            content: '';
            background:#53a4f0;
            display: block;
            position: absolute;
            padding-top: 300%;
            padding-left: 350%;
            margin-left: -20px !important;
            margin-top: -120%;
            opacity: 0;
            transition:all 0.8s;
        }
        .niceButton2:active::after{
            padding: 0;
            margin: 0;
            opacity: 1;
            transition: 0s;
        }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

效果:
在这里插入图片描述

2.带下压效果的按钮

html部分:

 <button class="niceButton">1111</button>
  • 1

css部分:

.niceButton{
    display: inline-block;
    padding: 15px 25px;
    font-size: 24px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    outline: none;
    color:#fff;
    background-color: rgb(16, 185, 214);
    border: none;
    border-radius: 15px;
    box-shadow: 0 9px #999;
}
.niceButton:hover{
background-color: #1795bb;
}
.niceButton:active{
    background-color: #1795bb;
    box-shadow: 0 5px #666;
    transform:translateY(4px);
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

效果:
在这里插入图片描述

鼠标悬停效果的按钮

html部分:

<button class="niceButton3">1111</button>
  • 1

css部分:

    .niceButton3 {
        background-color: #1795bb;
        border-radius: 12px;
        border: none;
        color: white;
        padding: 16px 32px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 16px;
        margin: 4px 2px;
        -webkit-transition-duration: 0.4s;
        transition-duration: 0.4s;
        cursor: pointer;
      }
      .niceButton3:hover {
        background-color: #fff;
        color: #1795bb;
        border: 1px solid #ccc;
      }

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果:
在这里插入图片描述

4.鼠标悬停后出现阴影

html部分:

<button class="niceButton4">1111</button>
  • 1

css部分:

.niceButton4{
    background-color: skyblue;
    border: none;
    border-radius: 12px;
    color:white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    transition-duration: 0.4s;
    -webkit-transition-duration: 0.4s;
}
.niceButton4:hover{
    box-shadow: 0 12px 16px 0 rgba(0,0,0,.24),
    0 17px 50px 0 rgba(0,0,0,.19);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

效果:
在这里插入图片描述

5.悬停后出现箭头图标

html部分:

<button class="niceButton5"><span>1111</span></button>
  • 1

css部分:

/* 悬停添加箭头图标 */
   .niceButton5 {
        display: inline-block;
        border-radius: 20px;
        background-color: #f4511e;
        border: none;
        color: #ffff;
        text-align: center;
        font-size: 28px;
        font-weight: 400;
        padding: 18px;
        width: 200px;
        transition: all 0.5s;
        cursor: pointer;
        margin: 5px;
        vertical-align: middle;
      }
      .niceButton5 span {
        cursor: pointer;
        display: inline-block;
        position: relative;
        transition: 0.5s;
      }
      .niceButton5 span::after {
        content: ">";
        position: absolute;
        opacity: 0;
        top: 0;
        right: -20px;
        transition: 0.5s;
      }
      .niceButton5:hover span {
        padding-right: 30px;
      }
      .niceButton5:hover span::after {
        opacity: 1;
        right: 0;
      }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38

效果:
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/297017
推荐阅读
相关标签
  

闽ICP备14008679号