Responsive clip-path with inline SVG

后端 未结 1 917
遇见更好的自我
遇见更好的自我 2020-12-06 05:57

On an element with a background (image or solid color don\'t really matter):

I am trying

1条回答
  •  执念已碎
    2020-12-06 06:42

    References to SVG clip paths are to the clip path definitions themselves and the dimensions or other attributes of the are meaningless in this context.

    What is happening in your example is that you are applying a 4000 px wide clip path to your header. Which is probably only of the order of 900 px wide. So the curvature isn't visible.

    If you want a responsive clip path, you should define it using clipPathUnits="objectBoundingBox".

    #block-header {
        background: Red;
        min-height: 100px;
        -webkit-clip-path: url(#myClip);
    	clip-path: url(#myClip);
    }

    SVG image

    clip-path using the same SVG

    Fiddle here

    0 讨论(0)
提交回复
热议问题