I am trying to use an SVG mask and the CSS clip-path
property to make some "ragged" section dividers on a website.
I need to be able to apply ese "ragged" bottom edges to sections/rows of any height, and so I need to be able to position and hopefully scale them as needed, depending on the height of the section, and hopefully the viewport width as well.
I am able to add the SVG mask using the clip-path: url(#svg-id);
method — so far so good!
I have not been able to figure out how to position the SVG (e.g. move up or down the page) using CSS, but I did figure out that I can add a transform="translate(X,Y);"
attribute to the svg path itself in the HTML as workaround to position the SVG.
The issue now is that when if I move the SVG down the page using this method, it begins to mask off the top edge of the masked element too — behaving like a "window" and masking off everything outside of it, as opposed to just masking the masked portion of the SVG.
Here is a codepen to show where I am at so far: https://codepen.io/moonweasel/pen/PomJgej
I would appreciate any pointers anyone can give me on how to use the SVG to only mask off the bottom edge of the element it is applied to, and leave the rest of the element showing, and also if possible how to position the SVG using CSS instead of having to add attributes to the HTML SVG path.