CSS+HTML<filter-Hover特效>

效果图:
hover.gif
代码如下:
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        :root {
            /* :root 相当于全局设置一个宽高的变量,此处可以不用这样写也能实现效果 */
            --height: 100px;
            --width: 200px;
        }

        * {
            margin: 0 auto;
        }

        body,
        html {
            height: 100%;
            width: 100%
        }

        body {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .button-box {
            width: 200px;
            height: 70px;
            box-shadow: 2px 2px 5px #ccc;
            text-align: center;
            line-height: 70px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .button-box .text {
            color: rgb(15, 240, 221);
            text-transform: uppercase;
            font-weight: bold;
            font-size: 23px;
            position: relative;
            z-index: 5;
            transition: all 2.5s cubic-bezier(0.1, 0.22, 0.3, 1);
        }
        .button-box:hover .text{
            color: white;
        }
        .button-box .back {
            position: absolute;
            left: -50%;
            bottom: -50%;
            width: 0;
            height: 0;
            filter: url(#filter);
            border-radius: 50%;
            z-index: 5;
            transition: all 2.5s cubic-bezier(0.1, 0.22, 0.3, 1);
            background: #0dbb55;
        }

        .button-box:hover .back {
            width: calc(2 * var(--width)) !important;
            height: calc(2 * var(--height)) !important;
        }
    </style>
</head>

<body>
        <!-- https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter -->
        <svg width="0" height="0" style="display: none">
                <filter id="filter">
                    <feTurbulence type="fractalNoise" baseFrequency=".01" numOctaves="4" />
                    <feDisplacementMap in="SourceGraphic" scale="100" />
                </filter>
            </svg>
    <div class="button-box">
            <div class="back"></div>
        <span class="text">hover</span>
      
    </div>
   
</body>

</html>
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 本文主要是起笔记的作用,内容来自慕课网. 认识CSS样式 CSS全称为“层叠样式表 (Cascading Styl...
    0o冻僵的企鹅o0阅读 2,752评论 0 30
  • 引言 在日常开发Android中,很多时候会遇到和WebView打交道,对CSS HTML JS不是很清楚的话是完...
    张文靖同学阅读 2,940评论 0 11
  • 脑图复习 Html和CSS的关系 学习web前端开发基础技术需要掌握:HTML、CSS、JavaScript语言。...
    朝南而行_阅读 12,556评论 1 9
  • 问答题47 /72 常见浏览器兼容性问题与解决方案? 参考答案 (1)浏览器兼容问题一:不同浏览器的标签默认的外补...
    _Yfling阅读 14,190评论 1 92
  • CSS格式化排版 1、字体 我们可以使用css样式为网页中的文字设置字体、字号、颜色等样式属性。下面我们来看一个例...
    张文靖同学阅读 1,380评论 0 3

友情链接更多精彩内容