首页 > 其他分享 >按钮效果(转载)Button effect (reprint)

按钮效果(转载)Button effect (reprint)

时间:2024-01-23 14:16:13浏览次数:25  
标签:btn Button after effect width hover reprint border before

    <title>CodePen - Button Hover Effects</title>

    <style>
        html {
            padding-top: 50px;
            font-family: "Open Sans", Helvetica, arial, sans-serif;
            text-align: center;
            background-color: #eeeeee;
        }

        html *,
        html *:before,
        html *:after {
            box-sizing: border-box;
            -webkit-transition: 0.5s;
            transition: 0.5s;
        }

        html i,
        html em,
        html b,
        html strong,
        html span {
            -webkit-transition: none;
            transition: none;
        }

        *:before,
        *:after {
            z-index: -1;
        }

        h1,
        h4 {
            font-family: "Raleway", "Open Sans", sans-serif;
            margin: 0;
            line-height: 1;
        }

        a {
            text-decoration: none;
            line-height: 80px;
            color: black;
        }

        .centerer {
            width: 100%;
            max-width: 600px;
            margin: 0 auto;
        }

        .wrap {
            width: 50%;
            float: left;
        }

        [class^="btn-"] {
            position: relative;
            display: block;
            margin: 20px auto;
            width: 100%;
            height: 80px;
            max-width: 250px;
            text-transform: uppercase;
            overflow: hidden;
            border: 1px solid currentColor;
        }

        .btn-0 {
            color: #925073;
        }

        .btn-0:before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 0;
            height: 80px;
            background: #4c1d36;
        }

        .btn-0:hover {
            color: #dfccd6;
        }

        .btn-0:hover:before {
            width: 250px;
        }

        .btn-0:active {
            background: #7f315a;
        }

        .btn-1 {
            color: #af4e49;
        }

        .btn-1:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: #611c19 transparent transparent transparent;
            position: absolute;
            top: 0;
            left: 0;
        }

        .btn-1:hover {
            color: #e8cbca;
        }

        .btn-1:hover:after {
            border-width: 330px 330px 0 0;
        }

        .btn-1:active {
            background: #a12f29;
        }

        .btn-1-2 {
            color: #61cdbe;
        }

        .btn-1-2:before {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent transparent #29766b;
            position: absolute;
            bottom: 0;
            left: 0;
        }

        .btn-1-2:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent #29766b transparent;
            position: absolute;
            right: 0;
            bottom: 0;
        }

        .btn-1-2:hover {
            color: #d1f0ec;
        }

        .btn-1-2:hover:before {
            border-width: 206.25px 0 0 206.25px;
        }

        .btn-1-2:hover:after {
            border-width: 0 0 206.25px 206.25px;
        }

        .btn-1-2:active {
            background: #45c4b3;
        }

        .btn-2 {
            color: #306570;
        }

        .btn-2:before {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent transparent #072c34;
            position: absolute;
            bottom: 0;
            left: 0;
        }

        .btn-2:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent #072c34 transparent transparent;
            position: absolute;
            top: 0;
            right: 0;
        }

        .btn-2:hover {
            color: #c2d2d5;
        }

        .btn-2:hover:before {
            border-width: 165px 0 0 165px;
        }

        .btn-2:hover:after {
            border-width: 0 165px 165px 0;
        }

        .btn-2:active {
            background: #0c4a57;
        }

        .btn-3 {
            color: #c45561;
        }

        .btn-3:before {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent transparent #6f2129;
            position: absolute;
            bottom: 0;
            left: 0;
        }

        .btn-3:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent #6f2129 transparent transparent;
            position: absolute;
            top: 0;
            right: 0;
        }

        .btn-3 span:before {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent #6f2129 transparent;
            position: absolute;
            right: 0;
            bottom: 0;
        }

        .btn-3 span:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: #6f2129 transparent transparent transparent;
            position: absolute;
            top: 0;
            left: 0;
        }

        .btn-3:hover {
            color: #eecdd1;
        }

        .btn-3:hover:before {
            border-width: 165px 0 0 165px;
        }

        .btn-3:hover:after {
            border-width: 0 165px 165px 0;
        }

        .btn-3:hover span:before {
            border-width: 0 0 165px 165px;
        }

        .btn-3:hover span:after {
            border-width: 165px 165px 0 0;
        }

        .btn-3:active {
            background: #b93745;
        }

        .btn-4 {
            color: #7d8d5c;
        }

        .btn-4:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent #3d4926 transparent transparent;
            position: absolute;
            top: 0;
            right: 0;
        }

        .btn-4:before {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent transparent #3d4926;
            position: absolute;
            bottom: 0;
            left: 0;
        }

        .btn-4:before,
        .btn-4:after {
            border-color: #3d4926;
        }

        .btn-4 span:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: #3d4926 transparent transparent transparent;
            position: absolute;
            top: 0;
            left: 0;
        }

        .btn-4 span:before {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent #3d4926 transparent;
            position: absolute;
            right: 0;
            bottom: 0;
        }

        .btn-4 span:before,
        .btn-4 span:after {
            border-color: #3d4926;
        }

        .btn-4:hover {
            color: #d9decf;
        }

        .btn-4:hover:before {
            border-width: 20px 63px;
        }

        .btn-4:hover:after {
            border-width: 20px 63px;
        }

        .btn-4:hover span:before {
            border-width: 20px 63px;
        }

        .btn-4:hover span:after {
            border-width: 20px 63px;
        }

        .btn-4:active {
            background: #66793f;
        }

        .btn-5 {
            color: #2a4770;
        }

        .btn-5:after {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent #021734 transparent transparent;
            position: absolute;
            top: 0;
            right: 0;
        }

        .btn-5:before {
            content: "";
            width: 0;
            height: 0;
            -webkit-transform: rotate(360deg);
            border-style: solid;
            border-width: 0 0 0 0;
            border-color: transparent transparent transparent #021734;
            position: absolute;
            bottom: 0;
            left: 0;
        }

        .btn-5:hover {
            color: #c0c9d5;
        }

        .btn-5:hover:before,
        .btn-5:hover:after {
            border-width: 80px 262.5px;
        }

        .btn-5:active {
            background: #042757;
        }

        .btn-6 {
            color: #a751d0;
        }

        .btn-6 span {
            position: absolute;
            display: block;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: #5b1e78;
            -webkit-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
            -webkit-transition: width 0.4s, height 0.4s;
            transition: width 0.4s, height 0.4s;
            z-index: -1;
        }

        .btn-6:hover {
            color: #e5ccf1;
        }

        .btn-6:hover span {
            width: 562.5px;
            height: 562.5px;
        }

        .btn-6:active {
            background: #9832c8;
        }

        .btn-7 {
            color: #41c46a;
        }

        .btn-7:before,
        .btn-7:after,
        .btn-7 span:before,
        .btn-7 span:after {
            content: "";
            position: absolute;
            top: 0;
            width: 63.5px;
            height: 0;
            background: #136f30;
        }

        .btn-7:before {
            left: 0;
        }

        .btn-7:after {
            left: 125px;
        }

        .btn-7 span:before,
        .btn-7 span:after {
            top: auto;
            bottom: 0;
        }

        .btn-7 span:before {
            left: 62.5px;
        }

        .btn-7 span:after {
            left: 187.5px;
        }

        .btn-7:hover {
            color: #c7eed3;
        }

        .btn-7:hover:before,
        .btn-7:hover:after,
        .btn-7:hover span:before,
        .btn-7:hover span:after {
            height: 80px;
        }

        .btn-7:active {
            background: #1fb950;
        }

        .btn-8 {
            color: #377660;
        }

        .btn-8:before,
        .btn-8:after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 250px;
            height: 0;
            background: #0c3829;
        }

        .btn-8:after {
            top: auto;
            bottom: 0;
        }

        .btn-8:hover {
            color: #c4d7d0;
        }

        .btn-8:hover:before,
        .btn-8:hover:after {
            height: 40px;
        }

        .btn-8:active {
            background: #145e44;
        }

        .btn-9 {
            color: #9b5097;
        }

        .btn-9:before,
        .btn-9:after,
        .btn-9 span:before,
        .btn-9 span:after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 250px;
            height: 0;
            background: rgba(82, 29, 80, 0.25);
            -webkit-transition: 0.4s;
            transition: 0.4s;
        }

        .btn-9:after,
        .btn-9 span:before {
            top: auto;
            bottom: 0;
        }

        .btn-9 span:before,
        .btn-9 span:after {
            -webkit-transition-delay: 0.4s;
            transition-delay: 0.4s;
        }

        .btn-9:hover {
            color: #e2cce1;
        }

        .btn-9:hover:before,
        .btn-9:hover:after,
        .btn-9:hover span:before,
        .btn-9:hover span:after {
            height: 80px;
        }

        .btn-9:active {
            background: #893185;
        }

        .btn-10 {
            color: #4ab36a;
        }

        .btn-10:before,
        .btn-10:after,
        .btn-10 span:before,
        .btn-10 span:after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 0;
            height: 80px;
            background: rgba(25, 99, 48, 0.25);
            -webkit-transition: 0.4s;
            transition: 0.4s;
        }

        .btn-10:after,
        .btn-10 span:before {
            left: auto;
            right: 0;
        }

        .btn-10 span:before,
        .btn-10 span:after {
            -webkit-transition-delay: 0.4s;
            transition-delay: 0.4s;
        }

        .btn-10:hover {
            color: #cae9d3;
        }

        .btn-10:hover:before,
        .btn-10:hover:after,
        .btn-10:hover span:before,
        .btn-10:hover span:after {
            width: 250px;
        }

        .btn-10:active {
            background: #2aa550;
        }

        @-webkit-keyframes criss-cross-left {
            0% {
                left: -20px;
            }
            50% {
                left: 50%;
                width: 20px;
                height: 20px;
            }
            100% {
                left: 50%;
                width: 375px;
                height: 375px;
            }
        }

        @keyframes criss-cross-left {
            0% {
                left: -20px;
            }
            50% {
                left: 50%;
                width: 20px;
                height: 20px;
            }
            100% {
                left: 50%;
                width: 375px;
                height: 375px;
            }
        }

        @-webkit-keyframes criss-cross-right {
            0% {
                right: -20px;
            }
            50% {
                right: 50%;
                width: 20px;
                height: 20px;
            }
            100% {
                right: 50%;
                width: 375px;
                height: 375px;
            }
        }

        @keyframes criss-cross-right {
            0% {
                right: -20px;
            }
            50% {
                right: 50%;
                width: 20px;
                height: 20px;
            }
            100% {
                right: 50%;
                width: 375px;
                height: 375px;
            }
        }

        .btn-11 {
            position: relative;
            color: #9248bc;
        }

        .btn-11:before,
        .btn-11:after {
            position: absolute;
            top: 50%;
            content: "";
            width: 20px;
            height: 20px;
            background: #7f28b0;
            border-radius: 50%;
        }

        .btn-11:before {
            left: -20px;
            -webkit-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
            /*     animation: criss-cross-left 0.8s reverse; */
        }

        .btn-11:after {
            right: -20px;
            -webkit-transform: translate(50%, -50%);
            transform: translate(50%, -50%);
            /*     animation: criss-cross-right 0.8s reverse; */
        }

        .btn-11:hover:before,
        .btn-11:hover:after {
            /*       @include size($btn-width); */
        }

        .btn-11:hover:before {
            -webkit-animation: criss-cross-left 0.8s both;
            animation: criss-cross-left 0.8s both;
        }

        .btn-11:hover:after {
            -webkit-animation: criss-cross-right 0.8s both;
            animation: criss-cross-right 0.8s both;
        }
    </style>
</head>

<body>
    <div class="centerer">
        <h1>Just Some More</h1>
        <h1>Button Hover Effects</h1>
        <h4>By: <a href="http://kylebrumm.com">Kyle Brumm</a></h4>

        <div class="wrap">
            <a class="btn-0" href="#">Swipe</a>
            <a class="btn-1" href="#">Diagonal Swipe</a>
            <a class="btn-1-2" href="#">Double Swipe</a>
            <a class="btn-2" href="#">Diagonal Close</a>
            <a class="btn-3" href="#"><span>Zoning In</span></a>
            <a class="btn-4" href="#"><span>4 Corners</span></a>
            <a class="btn-5" href="#">Slice</a>
        </div>
        <div class="wrap">
            <a class="btn-6" href="#">Position Aware<span></span></a>
            <a class="btn-7" href="#"><span>Alternate</span></a>
            <a class="btn-8" href="#">Smoosh</a>
            <a class="btn-9" href="#"><span>Vertical Overlap</span></a>
            <a class="btn-10" href="#"><span>Horizontal Overlap</span></a>
            <a class="btn-11" href="#">Collision</a>
        </div>
    </div>

    <script src="http://zaole.net/sliding.js"></script>

    <script>
        $(function () {
            $(".btn-6")
                .on("mouseenter", function (e) {
                    var parentOffset = $(this).offset(),
                        relX = e.pageX - parentOffset.left,
                        relY = e.pageY - parentOffset.top;
                    $(this).find("span").css({
                        top: relY,
                        left: relX,
                    });
                })
                .on("mouseout", function (e) {
                    var parentOffset = $(this).offset(),
                        relX = e.pageX - parentOffset.left,
                        relY = e.pageY - parentOffset.top;
                    $(this).find("span").css({
                        top: relY,
                        left: relX,
                    });
                });
            $("[href=#]").click(function () {
                return false;
            });
        });
        //@ sourceURL=pen.js
    </script>

    <script>
        if (document.location.search.match(/type=embed/gi)) {
            window.parent.postMessage("resize", "*");
        }
    </script>
</body>

标签:btn,Button,after,effect,width,hover,reprint,border,before
From: https://www.cnblogs.com/bzfy/p/17982303

相关文章

  • input标签不同的type属性值:password、text、checkbox、button、radio
    input标签用于搜集用户信息根据不同的type属性值,输入字段拥有很多形式。输入字段可以是文本字段、复选框、掩码后的文本控件、单选按钮、按钮等等。type属性:button:定义可点击的按钮checkbox:定义复选框file:定义输入字段和“浏览”按钮hidden:定义隐藏的输入字段。image:定......
  • useeffect发起请求,以及内部使用 async和await
    一定要执行一次具名函数+函数执行useEffect(()=>{asyncfunctionfetchData(){try{constresponse=awaitfetch('https://api.example.com/data');constdata=awaitresponse.json();//处理获取到的数据c......
  • Effective Java中文版(第3版)PDF
    本书一共包含90个条目,每个条目讨论Java程序设计中的一条规则。这些规则反映了最有经验的优秀程序员在实践中常用的一些有益的做法。全书以一种比较松散的方式将这些条目组织成11章,每一章都涉及软件设计的一个主要方面。因此,本书并不一定需要按部就班地从头读到尾,因为每个条目都有一......
  • 微信小程序 button、image组件
       image组件的基本使用:默认情况下,一个空白的<image></image>组件也会占据一定的宽度和高度 image组件的mode属性:(eg:<image src="/images/1.png" mode="aspectFit"></image>) ......
  • 前端歌谣-第伍拾伍课-vue2-element组件封装el-button-groups
    前言大家好我是歌谣今天继续给大家带来elementui组件el-button的封装使用方法<btn-groups:btns="btns":max="max"class="page-btns"></btn-groups>参数部分name控制属性名显示按钮的名称{{item.name}}btns:[{//按钮名称name:"歌谣&qu......
  • 前端歌谣-第伍拾陆课-vue2-element组件封装el-button-groups(续)
    前言我是歌谣今天继续给大家带来el-button-groups(项目的讲解背景颜色属性color:style="item.color?{background:item.color,borderColor:item.color}:{}"btns:[{//按钮名称name:"歌谣",//按钮类型......
  • Unity3D UGUI的Button组件的介绍及使用详解
    Unity3D是一款功能强大的游戏开发引擎,而UGUI是Unity3D提供的一套用户界面系统。在UGUI中,Button组件是最常用的组件之一,本文将详细介绍Button组件的使用方法和相关技术细节。对啦!这里有个游戏开发交流小组里面聚集了一帮热爱学习游戏的零基础小白,也有一些正在从事游戏开发的技术大......
  • 【愚公系列】2024年01月 WPF控件专题 RadioButton控件详解
    ......
  • React Hook 之 Effect :同步与外部系统的数据
    有时组件中的数据需要与外部系统的数据或操作同步,React提供了HookEffect。Effect会在组件渲染后运行一些代码,以便将组件与React之外的某些系统同步,包比如浏览器API、第三方小部件,以及网络请求等。如以下的video播放器的简单加载://声明Effectimport{useEffect,useRef......
  • C++ Qt开发:RadioButton单选框分组组件
    Qt是一个跨平台C++图形界面开发库,利用Qt可以快速开发跨平台窗体应用程序,在Qt中我们可以通过拖拽的方式将不同组件放到指定的位置,实现图形化开发极大的方便了开发效率,本章将重点介绍QRadioButton单选框组件以及与之交互的QButtonGroup类的常用方法及灵活运用。QRadioButton是Qt框架......