Moving dotted border using CSS

后端 未结 8 1864
感情败类
感情败类 2020-12-08 10:57

I have class that applies a dotted style border property to a text block at runtime. I am trying to find a solution, using CSS, that makes the border move like a gif image.

相关标签:
8条回答
  • 2020-12-08 11:24

    Not CSS3, but it works: http://matthewjamestaylor.com/blog/animated-photoshop-selection-on-a-web-page

    You can make it without images, by utlizing CSS3 gradients for the stripes and animating background-position (rough demo: http://codepen.io/christopheschwyzer/pen/CEwBI), but I wouldn't recommend it since it would only work well on Webkit.

    0 讨论(0)
  • 2020-12-08 11:24

    I've made a complete example based on this article. Enjoy!

    .outer {
      position: absolute;
      
      left: 100px;
      top: 50px;
      width: 100px;
      height: 100px;
      
      background-image: url(http://matthewjamestaylor.com/blog/selection.gif);
      
      border: 1px solid;
    }
    
    .selected {
      border: 0px;
    }
    
    .inner {
      position:absolute;
      bottom: 0;
      top: 0;
      left: 0;
      right: 0;
    
      background-color: #9CF;
    }
    
    .selected .inner {
      margin: 1px;
    }
    <div class="outer selected">
      <div class="inner" />
    </div>

    0 讨论(0)
提交回复
热议问题