中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

css如何實現圖片邊框運動動畫

發布時間:2022-03-05 09:38:46 來源:億速云 閱讀:160 作者:小新 欄目:web開發

這篇文章給大家分享的是有關css如何實現圖片邊框運動動畫的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

如何實現圖片的邊框運動,這點在一些移動端的效果的經常應用,下面是圖標邊框運動實現代碼:

<!DOCTYPE html>

<html lang="en" class="no-js">

 

       <head>

              <meta charset="UTF-8" />

              <meta http-equiv="X-UA-Compatible" content="IE=edge">

              <meta name="viewport" content="width=device-width, initial-scale=1">

              <title>Border Animation Effect with SVG</title>

              <meta name="description" content="Border Animation Effect: Recreating the effect seen on carlphilippebrenner.com with SVG" />

              <meta name="keywords" content="svg, border effect, animated border, line, grid item, hover, css" />

              <!--<link rel="stylesheet" type="text/css" href="css/demo.css" />-->

              <!--<link rel="stylesheet" type="text/css" href="css/component.css" />-->

              <style>

                     @import url(http://fonts.useso.com/css?family=Lato:300,400,700|Ruthie);

                     @font-face {

                            font-weight: normal;

                            font-style: normal;

                            font-family: 'codropsicons';

                            src: url('../fonts/codropsicons/codropsicons.eot');

                            src: url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'), url('../fonts/codropsicons/codropsicons.woff') format('woff'), url('../fonts/codropsicons/codropsicons.ttf') format('truetype'), url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg');

                     }

                    

                     *,

                     *:after,

                     *:before {

                            -webkit-box-sizing: border-box;

                            -moz-box-sizing: border-box;

                            box-sizing: border-box;

                     }

                    

                     .clearfix:before,

                     .clearfix:after {

                            content: '';

                            display: table;

                     }

                    

                     .clearfix:after {

                            clear: both;

                     }

                    

                     body {

                            background: #2c3e50;

                            color: #ecf0f1;

                            font-size: 100%;

                            line-height: 1.25;

                            font-family: 'Lato', Arial, sans-serif;

                     }

                    

                     a {

                            color: #95a5a6;

                            text-decoration: none;

                            outline: none;

                     }

                    

                     a:hover,

                     a:focus {

                            color: #fff;

                     }

                    

                     .codrops-header {

                            margin: 0 auto;

                            padding: 2em;

                            text-align: center;

                     }

                    

                     .codrops-header h2 {

                            margin: 0;

                            font-weight: 300;

                            font-size: 2.5em;

                     }

                    

                     .codrops-header h2 span {

                            display: block;

                            padding: 0 0 0.6em 0.1em;

                            font-size: 0.6em;

                            opacity: 0.7;

                     }

                     /* To Navigation Style */

                    

                     .codrops-top {

                            width: 100%;

                            text-transform: uppercase;

                            font-weight: 700;

                            font-size: 0.69em;

                            line-height: 2.2;

                     }

                    

                     .codrops-top a {

                            display: inline-block;

                            padding: 0 1em;

                            text-decoration: none;

                            letter-spacing: 1px;

                     }

                    

                     .codrops-top span.right {

                            float: right;

                     }

                    

                     .codrops-top span.right a {

                            display: block;

                            float: left;

                     }

                    

                     .codrops-icon:before {

                            margin: 0 4px;

                            text-transform: none;

                            font-weight: normal;

                            font-style: normal;

                            font-variant: normal;

                            font-family: 'codropsicons';

                            line-height: 1;

                            speak: none;

                            -webkit-font-smoothing: antialiased;

                     }

                    

                     .codrops-icon-drop:before {

                            content: "\e001";

                     }

                    

                     .codrops-icon-prev:before {

                            content: "\e004";

                     }

                    

                     section {

                            padding: 4em 2em;

                            text-align: center;

                     }

                    

                     section h3 {

                            font-weight: 300;

                            font-size: 2em;

                            padding: 1em 0;

                     }

                    

                     .codrops-header+section {

                            padding-top: 1.5em;

                     }

                    

                     .related p {

                            font-size: 1.5em;

                     }

                    

                     .related>a {

                            background: rgba(0, 0, 0, 0.05);

                            display: inline-block;

                            text-align: center;

                            margin: 20px 10px;

                            padding: 25px;

                            -webkit-transition: color 0.3s, background-color 0.3s;

                            transition: color 0.3s, background-color 0.3s;

                     }

                    

                     .related a:hover {

                            background-color: rgba(0, 0, 0, 0.4);

                     }

                    

                     .related a img {

                            max-width: 100%;

                            opacity: 0.8;

                            -webkit-transition: opacity 0.3s;

                            transition: opacity 0.3s;

                     }

                    

                     .related a:hover img,

                     .related a:active img {

                            opacity: 1;

                     }

                    

                     .related a h4 {

                            margin: 0;

                            padding: 0.5em 0 0.3em;

                            max-width: 300px;

                            text-align: left;

                     }

                    

                     @media screen and (max-width: 25em) {

                            .codrops-icon span {

                                   display: none;

                            }

                     }

                    

                     .box {

                            width: 300px;

                            height: 460px;

                            position: relative;

                            background: rgba(255, 255, 255, 1);

                            display: inline-block;

                            margin: 0 10px;

                            cursor: pointer;

                            color: #2c3e50;

                            box-shadow: inset 0 0 0 3px #2c3e50;

                            -webkit-transition: background 0.4s 0.5s;

                            transition: background 0.4s 0.5s;

                     }

                    

                     .box:hover {

                            background: rgba(255, 255, 255, 0);

                            -webkit-transition-delay: 0s;

                            transition-delay: 0s;

                     }

                    

                     .box h4 {

                            font-family: "Ruthie", cursive;

                            font-size: 180px;

                            line-height: 370px;

                            margin: 0;

                            font-weight: 400;

                            width: 100%;

                     }

                    

                     .box span {

                            display: block;

                            font-weight: 400;

                            text-transform: uppercase;

                            letter-spacing: 1px;

                            font-size: 13px;

                            padding: 5px;

                     }

                    

                     .box h4,

                     .box span {

                            -webkit-transition: color 0.4s 0.5s;

                            transition: color 0.4s 0.5s;

                     }

                    

                     .box:hover h4,

                     .box:hover span {

                            color: #fff;

                            -webkit-transition-delay: 0s;

                            transition-delay: 0s;

                     }

                    

                     .box svg {

                            position: absolute;

                            top: 0;

                            left: 0;

                     }

                    

                     .box svg line {

                            stroke-width: 3;

                            stroke: #ecf0f1;

                            fill: none;

                            -webkit-transition: all .8s ease-in-out;

                            transition: all .8s ease-in-out;

                     }

                    

                     .box:hover svg line {

                            -webkit-transition-delay: 0.1s;

                            transition-delay: 0.1s;

                     }

                    

                     .box svg line.top,

                     .box svg line.bottom {

                            stroke-dasharray: 330 240;

                     }

                    

                     .box svg line.left,

                     .box svg line.right {

                            stroke-dasharray: 490 400;

                     }

                    

                     .box:hover svg line.top {

                            -webkit-transform: translateX(-600px);

                            transform: translateX(-600px);

                     }

                    

                     .box:hover svg line.bottom {

                            -webkit-transform: translateX(600px);

                            transform: translateX(600px);

                     }

                    

                     .box:hover svg line.left {

                            -webkit-transform: translateY(920px);

                            transform: translateY(920px);

                     }

                    

                     .box:hover svg line.right {

                            -webkit-transform: translateY(-920px);

                            transform: translateY(-920px);

                     }

                     /* Alternatives */

                     /* Color */

                    

                     .demo-2 .box {

                            box-shadow: inset 0 0 0 10px #2c3e50;

                     }

                    

                     .demo-2 .box:hover h4,

                     .demo-2 .box:hover span {

                            color: #fe6f83;

                     }

                    

                     .demo-2 .box svg line {

                            stroke-width: 8;

                     }

                    

                     .demo-2 .box:hover svg line {

                            stroke: #fe6f83;

                     }

                     /* Frame */

                    

                     .demo-3 .box {

                            background: rgba(0, 0, 0, 0);

                            color: #fff;

                            box-shadow: none;

                            -webkit-transition: background 0.3s;

                            transition: background 0.3s;

                     }

                    

                     .demo-3 .box:hover {

                            background: rgba(0, 0, 0, 0.4);

                     }

                    

                     .demo-3 .box h4,

                     .demo-3 .box span {

                            -webkit-transition: none;

                            transition: none;

                     }

                    

                     .demo-3 .box svg line {

                            -webkit-transition: all .5s;

                            transition: all .5s;

                     }

                    

                     .demo-3 .box:hover svg line {

                            stroke-width: 10;

                            -webkit-transition-delay: 0s;

                            transition-delay: 0s;

                     }

                    

                     .demo-3 .box:hover svg line.top {

                            -webkit-transform: translateX(-300px);

                            transform: translateX(-300px);

                     }

                    

                     .demo-3 .box:hover svg line.bottom {

                            -webkit-transform: translateX(300px);

                            transform: translateX(300px);

                     }

                    

                     .demo-3 .box:hover svg line.left {

                            -webkit-transform: translateY(460px);

                            transform: translateY(460px);

                     }

                    

                     .demo-3 .box:hover svg line.right {

                            -webkit-transform: translateY(-460px);

                            transform: translateY(-460px);

                     }

                     /* Spin */

                    

                     .demo-4 .box {

                            box-shadow: none;

                            background: rgba(0, 0, 0, 0.4);

                            -webkit-transition: none;

                            transition: none;

                            color: #fff;

                     }

                    

                     .demo-4 .box h4,

                     .demo-4 .box span {

                            -webkit-transform: scale(0.9);

                            transform: scale(0.9);

                            -webkit-backface-visibility: hidden;

                            backface-visibility: hidden;

                            -webkit-transition: -webkit-transform 0.5s;

                            transition: transform 0.5s;

                     }

                    

                     .demo-4 .box:hover h4,

                     .demo-4 .box:hover span {

                            -webkit-transform: scale(1);

                            transform: scale(1);

                     }

                    

                     .demo-4 .box svg line {

                            stroke-width: 30;

                            -webkit-transition: all .4s;

                            transition: all .4s;

                     }

                    

                     .demo-4 .box:hover svg line {

                            -webkit-transition-delay: 0s;

                            transition-delay: 0s;

                     }

                    

                     .demo-4 .box:hover svg line {

                            stroke-width: 0;

                     }

                    

                     .demo-4 .box svg line.top,

                     .demo-4 .box svg line.bottom {

                            stroke-dasharray: 300;

                     }

                    

                     .demo-4 .box svg line.left,

                     .demo-4 .box svg line.right {

                            stroke-dasharray: 460;

                     }

                    

                     .demo-4 .box:hover svg line.top {

                            -webkit-transform: translateX(-300px);

                            transform: translateX(-300px);

                     }

                    

                     .demo-4 .box:hover svg line.bottom {

                            -webkit-transform: translateX(300px);

                            transform: translateX(300px);

                     }

                    

                     .demo-4 .box:hover svg line.left {

                            -webkit-transform: translateY(460px);

                            transform: translateY(460px);

                     }

                    

                     .demo-4 .box:hover svg line.right {

                            -webkit-transform: translateY(-460px);

                            transform: translateY(-460px);

                     }

              </style>

              <!--[if IE]>

            <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

              <![endif]-->

       </head>

 

       <body>

              <div class="container">

                     <header class="codrops-header">

                            <h2>Border Animation Effect <span>Recreating the effect seen on <a href="http://carlphilippebrenner.com/">carlphilippebrenner.com</a> with SVG</span></h2>

                            <p>Highly experimental, tested in Google Chrome and Firefox</p>

                     </header>

                     <section class="demo-1">

                            <div class="grid">

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>D</h4>

                                          <span>2012</span>

                                          <span>Broccoli, Asparagus, Curry</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>A</h4>

                                          <span>2013</span>

                                          <span>Arugula, Chickweed</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>S</h4>

                                          <span>2014</span>

                                          <span>Strawberry, Lemon</span>

                                   </div>

                            </div>

                            <!-- /grid -->

                     </section>

                     <section class="demo-2">

                            <h3>Color animation</h3>

                            <div class="grid">

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>J</h4>

                                          <span>2012</span>

                                          <span>Walnut, Pineapple</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>I</h4>

                                          <span>2013</span>

                                          <span>Curry, Beancurd</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>C</h4>

                                          <span>2014</span>

                                          <span>Lettuce, Asparagus</span>

                                   </div>

                            </div>

                            <!-- /grid -->

                     </section>

                     <section class="demo-3">

                            <h3>Frame</h3>

                            <div class="grid">

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>B</h4>

                                          <span>2012</span>

                                          <span>Marmalade, Honey</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>U</h4>

                                          <span>2013</span>

                                          <span>Beans, Chickweed</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>Q</h4>

                                          <span>2014</span>

                                          <span>Broccoli, Lettuce</span>

                                   </div>

                            </div>

                            <!-- /grid -->

                     </section>

                     <section class="demo-4">

                            <h3>Border spin</h3>

                            <div class="grid">

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>C</h4>

                                          <span>2012</span>

                                          <span>Berry, Spinach</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>A</h4>

                                          <span>2013</span>

                                          <span>Arugula, Chickweed</span>

                                   </div>

                                   <div class="box">

                                          <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">

                                                 <line class="top" x1="0" y1="0" x2="900" y2="0" />

                                                 <line class="left" x1="0" y1="460" x2="0" y2="-920" />

                                                 <line class="bottom" x1="300" y1="460" x2="-600" y2="460" />

                                                 <line class="right" x1="300" y1="0" x2="300" y2="1380" />

                                          </svg>

                                          <h4>J</h4>

                                          <span>2014</span>

                                          <span>Broccoli, Asparagus, Lettuce</span>

                                   </div>

                            </div>

                            <!-- /grid -->

                     </section>

              </div>

              <!-- /container -->

       </body>

 

</html>

 

感謝各位的閱讀!關于“css如何實現圖片邊框運動動畫”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

css
AI

邹平县| 攀枝花市| 丰台区| 昌都县| 卢龙县| 呼和浩特市| 嘉善县| 曲阜市| 佛坪县| 曲靖市| 上饶县| 县级市| 阳西县| 浦江县| 佛学| 大关县| 宿迁市| 宁夏| 江安县| 濮阳市| 吐鲁番市| 阳原县| 咸丰县| 黎平县| 扎囊县| 甘泉县| 六盘水市| 棋牌| 眉山市| 信宜市| 长泰县| 壶关县| 延川县| 海宁市| 亚东县| 闽侯县| 宜兰县| 阳信县| 新乐市| 仙游县| 石阡县|