zoukankan      html  css  js  c++  java
  • 利用svg描边+css3实现边框逐渐消失小动画

    首先简单的描述一下svg中两个属性:

    stroke-dasharray:表示每个虚线的长短。

    stroke-dashoffset:表示首个虚线的偏移量。

    当两者都特别大的时候就会消失掉

    直接上代码:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>边框逐渐消失</title>
        <style>
            .br_hide{
                text-decoration:none;
            }
            .br_hide:hover{
                text-decoration:none;
            }
            .br_hide:hover text{
                fill:#913F3F;
            }
            .br_hide:hover g{
                animation:first1 3s linear infinite;
                stroke:#913F3F;
                stroke-width:2;
                -moz-animation:first1 0.5s linear;
                -webkit-animation:first1 0.5s linear;
            }
            @-moz-keyframes first1
            {
                0%   {stroke-dasharray: 0%, 500%;stroke-dashoffset: 0%;}
                100%  {stroke-dasharray: 500%, 0%;stroke-dashoffset: 0%;}
            }
            @-webkit-keyframes first1
            {
                0%   {stroke-dasharray: 0%, 500%;stroke-dashoffset: 0%;}
                100%  {stroke-dasharray: 500%, 250%;stroke-dashoffset: 0%;}
            }
        </style>
    </head>
    <body>
    <a href="#" class="br_hide">
        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="80" height="36">
            <rect fill="none" stroke="#DBEAF9" stroke-width="2" width="80" height="36"/>
            <text x="10" y="24">王玉娇</text>
            <g fill="none" >
                <rect width="80" height="36"/>
            </g>
        </svg>
    </a>
    <a href="#" class="br_hide">
        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="80" height="36">
            <rect fill="none" stroke="#C8E3CB" stroke-width="2" width="80" height="36"/>
            <text x="10" y="24">王玉娇</text>
            <g fill="none" >
                <rect width="80" height="36"/>
            </g>
        </svg>
    </a>
    <a href="#" class="br_hide">
        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="80" height="36">
            <rect fill="none" stroke="#DBEAF9" stroke-width="2" width="80" height="36"/>
            <text x="10" y="24">王玉娇</text>
            <g fill="none" >
                <rect width="80" height="36"/>
            </g>
        </svg>
    </a>
    </body>
    </html>

    即可实现效果。

    努力吧,为了媳妇儿,为了家。。。
  • 相关阅读:
    Python内置的操作系统模块(os)与解释器交互模块(sys)
    Python常用模块-常见的加密算法模块使用
    Python常用模块-随机数模块(random)
    Python常用模块-时间模块(time&datetime)
    Python递归函数介绍
    Python内置函数之匿名(lambda)函数
    Python远程连接模块-Telnet
    Python的常用内置函数介绍
    Python的生成器进阶玩法
    Python中的列表解析和生成器表达式
  • 原文地址:https://www.cnblogs.com/jlj9520/p/6283636.html
Copyright © 2011-2022 走看看