剪辑路径多边形不适用于chrome

时间:2016-06-05 12:14:07

标签: google-chrome svg clip-path

您好,

我有这个SVG文件:

<svg preserveAspectRatio="" viewBox="0 0 130 280" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" height="280px" width="130px">
 <clipPath id="search">
  <polygon points="8.96671,272.712 118.624,272.876 118.624,276.683 117.128,278.335 34.7667,278.417 33.1129,279.327 13.9283,279.327 9.29748,275.689 9.29748,272.546"/>
 </clipPath>
</svg>

我的CSS代码:

clip-path:url("file.svg#search");
-webkit-clip-path:url(file.svg#search);

该元素在Firefox上被剪切但在Chrome上没有。那是为什么?

谢谢。

1 个答案:

答案 0 :(得分:0)

我添加overflow: hidden添加它适用于chrome 55.这是我的代码:

<svg id="mySVG" height="0" width="0">
     <defs>
         <clipPath id="customPath">
         <path d="M36.531,-0.000 C36.531,-0.000 -16.969,6.500 5.531,76.000 C28.031,145.500 138.531,534.000 138.531,534.000 C138.531,534.000 150.031,583.000 220.531,576.000 C291.031,569.000 1033.531,501.000 1033.531,501.000 C1033.531,501.000 1094.531,504.000 1099.531,428.500 C1104.531,353.000 1099.531,1.000 1099.531,1.000 L36.531,-0.000 Z" />
     </clipPath>
 </defs>

.wrapper-mask {
   clip-path: url(#customPath);
   width: 1100px;
   overflow: hidden;
   height: 577px;
   transform: scale(0.97) perspective(1px);
}