How to mask image using css form?
link
I already made a form with css border style, but could not overlay the image.
CSS
#triangle-topleft { width: 0; height: 0; border-top: 100px solid red; border-right: 100px solid transparent; }
Option 1 - SVG
<svg width="100" height="100"> <defs> <pattern id="a" patternUnits="userSpaceOnUse" width="100" height="100"> <image xlink:href="http://lorempixel.com/300/300" x="0" y="0" width="100" height="100" /> </pattern> </defs> <polygon points="0,0 100,0 50,100" fill="url(#a)" /> </svg>
Tested in Chrome, Firefox, IE9 +
Option 2 - clip-path
clip-path
.element { display:inline-block; -webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%); clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
<div class="element"> <img src="https://s3.amazonaws.com/uifaces/faces/twitter/ok/128.jpg" /> </div>
can i use
Grate's tutorial about clip-path: https://css-tricks.com/clipping-masking-css/
A tool for creating shapes this way: http://bennettfeely.com/clippy/
You can use for this gradients. Here is a sample code:
gradients
div { width: 100px; height: 100px; background-image: linear-gradient(to bottom left, white 50%, transparent 0), url('http://lorempixel.com/100/100'); }
<div></div>
Working violin