查看更多按钮效果

按钮效果如下

more.gif

首先HTML部分

 <a href="#" class="more">more<i class="fa fa-long-arrow-right"></i></a>

CSS部分

<style>
        .more {
            position: relative;
            display: inline-block;
            width: 130px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            color: #a8001c;
            background: #fff;
            box-shadow: 0 0 10px rgba(12, 3, 6, .13);
            z-index: 1;
            text-decoration: none;
        }
    
        .more i {
            position: relative;
            float: right;
            display: inline-block;
            width: 30px;
            height: 30px;
            line-height: 30px;
            background: #a8001c;
            color: #ffffff;
            font-size: 15px;
            z-index: 1;
        }
        .more:before {
            content: '';
            display: block;
            position: absolute;
            left: 0;
            top: 0;
            width: 0;
            height: 100%;
            background: #a8001c;
            transition: ease-out .35s;
            z-index: -1;
        }
        .more i:after { /*这里不可以用before伪元素,因为字体图标是在before的content中定义的*/
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            display: block;
            width: 0;
            height: 100%;
            background: #fff;
            transition: ease-in .65s;
            z-index: -1;
        }
        .more:hover {
            color: #fff;
        }
    
        .more:hover:before {
            width: 100%;
        }
    
        .more:hover i {
            color: #a8001c;
            transition-delay: .2s;
        }
    
        .more:hover i:after {
            width: 100%;
            transition-delay: .2s;
            transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
        }
    </style>

注意

  • 字体图标的before伪元素不要操作,因为里面的content定义了字体图标的内容
  • z-index的应用也要注意,不然文字会被覆盖掉
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML标准。 注意:讲述HT...
    kismetajun阅读 28,585评论 1 45
  • 问答题47 /72 常见浏览器兼容性问题与解决方案? 参考答案 (1)浏览器兼容问题一:不同浏览器的标签默认的外补...
    _Yfling阅读 14,026评论 1 92
  • HTML 5 HTML5概述 因特网上的信息是以网页的形式展示给用户的,因此网页是网络信息传递的载体。网页文件是用...
    阿啊阿吖丁阅读 4,855评论 0 0
  • CSS 是什么 css(Cascading Style Sheets),层叠样式表,选择器{属性:值;属性:值}h...
    崔敏嫣阅读 1,561评论 0 5
  • 精致生活,每个人都有不同的想法。在我看来,什么样的生活可以称的上是精致的呢?我要隆重介绍一位宝藏女孩——Susie...
    快乐的君君阅读 516评论 0 2

友情链接更多精彩内容