简体   繁体   English

将svg模式添加到border-image属性

[英]Adding svg pattern to border-image property

I'm attempting to add an SVG pattern to the bottom border of my DIV element. 我正在尝试将SVG模式添加到DIV元素的底部边框。 The approach i've taken is not working. 我采取的方法不起作用。 Here is the code so far. 这是到目前为止的代码。 . This is where I created the SVG pattern . 这是我创建SVG模式的地方 Lastly this is 最后是 效果类型 i'm trying to create in CSS. 我正在尝试在CSS中创建。

HTML 的HTML

<div class="pattern">
   hello
</div>

CSS 的CSS

.pattern{
  color:white;
  width: 500px;
  height: 500px;
  border-image:url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAP0lEQVQYV2P8////f0ZGRkYGAgCsgBjFcJMIKUaxEp9iDLfhUoxVIcjd6B7E6Vt0k/EGC7JiguEHU0xQISycASOfKAejj1tDAAAAAElFTkSuQmCC
  )repeat;
}

You could perhaps use the :after pseudo element to create the same effect: 您也许可以使用:after伪元素来创建相同的效果:

.pattern{
  color:white;
  width: 500px;
  height: 500px;
  position: relative;
  top: 0;
  left: 0;
}

.pattern:after{
  content: "";
  display: block;
  height: 8px;
  width: 100%;
  background-image:url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAP0lEQVQYV2P8////f0ZGRkYGAgCsgBjFcJMIKUaxEp9iDLfhUoxVIcjd6B7E6Vt0k/EGC7JiguEHU0xQISycASOfKAejj1tDAAAAAElFTkSuQmCC
  );
  position: absolute;
  bottom: 0;
  left: 0;  
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM