Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何将路径添加到剪辑路径_Css_Image_Svg - Fatal编程技术网

Css 如何将路径添加到剪辑路径

Css 如何将路径添加到剪辑路径,css,image,svg,Css,Image,Svg,尝试向图像添加波浪效果时, 我被卡住了。这两个svg-s,一个包含我试图实现的路径,第二个行为与预期一样,但在我粘贴到desierd路径时有一个错误的剪辑路径/形状,它不起作用。 为什么以及如何才能使这项工作成功 //设计路径 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1441 742" fill="none"> <path d=&qu

尝试向图像添加波浪效果时, 我被卡住了。这两个svg-s,一个包含我试图实现的路径,第二个行为与预期一样,但在我粘贴到desierd路径时有一个错误的剪辑路径/形状,它不起作用。 为什么以及如何才能使这项工作成功

//设计路径

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1441 742" fill="none">        
 <path  d="M0 740.5V0H1440.5V557C1369 549 1193.8 549.4 1073 615C922 
  697 809 702.5 698.5 685C611.987 671.299 465 603 286 677C142.8 736.2 35.6667 744 0 740.5Z" 
  fill="#001E61"/>
</svg>
      
      

//工作示例但不包括wrang路径

 img {
        clip-path: url(#svgClip);
        width: 100%;
        height: 800px;
        object-fit: cover;
        display: block;
        margin-right: auto;
        margin-left: auto;
    }

<img src="https://stage.popsacademy.se/wp-content/uploads/2020/10/popsacademybild2-1920x1080px-1920x1080.jpg" />

<svg width="0" height="0">
    <clipPath id="svgClip" clipPathUnits="objectBoundingBox">
        <path d="M0.75815095,0.0579477769 C0.879893708, 
          
        0.187288937 0.902165272,0 1,0.785996249 
          
        C0.627963035,0.966765889 0.26163708,0.71434951 
          
        0.111342491,0.755791573 C-0.0332137967,
          
        0.603287436 -0.035795248, 0.382887577 0.0965066612,
          
        0.173955315 C0.200239457,0.0101396315 0.648923894,
          
        -0.0580965318 0.75815095,0.0579477769 Z">
    
  </clipPath>
</svg>

  
img{
剪辑路径:url(#svgClip);
宽度:100%;
高度:800px;
对象匹配:覆盖;
显示:块;
右边距:自动;
左边距:自动;
}

正如您在工作示例中所看到的,用于剪裁图像的路径具有一个边界框宽度:1和高度<1。 你需要缩小你的路径

所需路径的边界框为宽度:1441高度:742。因为1/1441=0.00069,所以我将路径缩放为0.00069

*{margin:0;padding:0;}
img{width:100%;-webkit剪辑路径:url(#clip);
剪辑路径:url(#剪辑);}


相关: