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>

    即可实现效果。

    努力吧,为了媳妇儿,为了家。。。
  • 相关阅读:
    我们是在开发产品还是项目?
    创业期的软件开发管理(一)
    由“I”到“T”
    创业期的软件开发管理(二)
    平台架构用户系统
    产品的臃肿过程
    平台架构——体系结构
    狼群的架构暗示
    如何创建一个好的索引
    哈希索引
  • 原文地址:https://www.cnblogs.com/jlj9520/p/6283636.html
Copyright © 2011-2022 走看看