Advertisement

按钮悬浮动画过度效果CSS实现

阅读量:
在这里插入图片描述

实现动画过渡效果

在这里插入图片描述

css样式

复制代码
    <style>
    .button {
      display: inline-block;
      border-radius: 4px;
      background-color: #f4511e;
      border: none;
      color: #FFFFFF;
      text-align: center;
      font-size: 28px;
      padding: 20px;
      width: 200px;
      transition: all 0.5s;
      cursor: pointer;
      margin: 5px;
    }
    
    .button span {
      cursor: pointer;
      display: inline-block;
      position: relative;
      transition: 0.5s;
    }
    
    .button span:after {
      content: '»';
      position: absolute;
      opacity: 0;
      top: 0;
      right: -20px;
      transition: 0.5s;
    }
    
    .button:hover span {
      padding-right: 25px;
    }
    
    .button:hover span:after {
      opacity: 1;
      right: 0;
    }
    </style>

html

复制代码
    <button class="button" style="vertical-align:middle"><span>Hover </span></button>

全部评论 (0)

还没有任何评论哟~