Stripes Border like sample image css

◇◆丶佛笑我妖孽 提交于 2019-12-02 07:23:07

You can consider a multipe background coloration like below:

.box {
  width: 100px;
  height: 200px;
  border-right:  10px solid transparent;
  border-bottom: 10px solid transparent;
  background: 
   linear-gradient(#fff,#fff) center/calc(100% - 2px) calc(100% - 2px) padding-box,
   linear-gradient(blue,blue) padding-box,
   linear-gradient(#fff,#fff) top right  /10px 10px border-box,
   linear-gradient(#fff,#fff) bottom left/10px 10px border-box,
   /* you can replace this gradient with your SVG*/
   repeating-linear-gradient( -45deg, 
     transparent 0, transparent 2px, 
     blue 2px, blue 4px) border-box;
   /**/
  background-repeat:no-repeat;
  display:inline-block;
}
<div class="box"></div>
<div class="box" style="width:200px;"></div>
<div class="box" style="width:200px;height:100px"></div>

Use a repeating linear gradient on the pseudo-element and then position it absolutely behind the parent div.

The move it on hover.

div {
  width:150px;
  height: 200px;
  margin:1em auto;
  border:2px solid green;
   position: relative;
  background: white;
}

div:after {
  content:"";
  position: absolute;
  z-index:-1;
  top:0;
  left:0;
height:100%;
  width:100%;
   background: repeating-linear-gradient(
   -45deg, 
   transparent 0, 
   transparent 4px, 
   blue 4px, 
   blue 8px);
  transition:all .25s ease;
  
}

div:hover::after {
  left:8px;
  top:8px;

}
<div>Hover me</div>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!