简体   繁体   English

如何在没有 div 覆盖的情况下制作具有重叠 svg 边框的图像(类似框架)

[英]How can I make a image with overlapping svg border without div overlay (frame like)

I am looking for an effect like this:我正在寻找这样的效果:

可能性 1

可能性 1

Currently I have the problem that the border is every time behind the image.目前我遇到的问题是边框每次都在图像后面。

问题

I use following code:我使用以下代码:

.imgStyleBorder{
  border: 0.5rem solid white;
    border-image-slice: 100%;
    border-image-source: none;
    border-image-width: 1;
  border-image-source: url(rand3.svg);
  border-image-width: 0.5rem;
  border-image-slice: 8%;
}

The HTML looks like: HTML 看起来像:

<div class="imgStyleBorder">
    <a data-id="130" class="" href="https://www.sir-barkalot.de/burg-neu-windeck/">
        <img src="https://www.sir-barkalot.de/wp-content/uploads/2022/08/IMG_1820-scaled.jpg" class="rt-img-responsive " alt="" width="2560" height="1707">
    </a>
</div>

To see the behavior in real live you can look to the Sample Page .要查看真实的行为,您可以查看示例页面

Is it possible too lay the border overlapping over the image without an extra div?是否有可能在没有额外 div 的情况下将边框重叠在图像上?

You need to upload landscape pattern for landscape image and use background image instead of border-image.您需要为横向图片上传横向图案并使用背景图片而不是边框图片。

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

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