css - How to align two svg masked images on the same line -
i have svg mask , mask works on image in chrome not allow me align 2 images . when align 2 images , apply mask, displays 1 image , when write text before image, text hides image.
this svg code
<svg width="0" height="0"> <defs> <clippath id="shape"> <path transform="translate(0.000000,163.000000) scale(0.100000,-0.100000)" d="m373 1197 c-355 -355 -363 -363 -363 -402 0 -39 8 -47 363 -402 355 -355 363 -363 402 -363 39 0 47 8 402 363 355 355 363 363 363 402 0 39 -8 47 -363 402 -355 355 -363 363 -402 363 -39 0 -47 -8 -402 -363z" /> </clippath> </defs> </svg> <img class='photo_rectangle_inverse' src='http://i.imgur.com/nr6kefg.jpg' /> <img class='photo_rectangle_inverse' src='http://i.imgur.com/dxah323.jpg' />
and here css code
.photo_rectangle_inverse { height:160px; width:170px; -webkit-clip-path: url(#shape); clip-path: url(#shape); }
so supposed display 2 images displays 1
but supposed display mask on 2 images
<img class='photo_rectangle_inverse' src='http://i.imgur.com/nr6kefg.jpg' /> <img class='photo_rectangle_inverse' src='http://i.imgur.com/dxah323.jpg' />
here jsfiddle
how dispaly , align 2 svg masked images on same line ? thanks
you using svg translate()
functionality moves shape. causing shape not in right place every time.
what need fix add piece of css sort out position. being -webkit-transform:translatez(1px);
.photo_rectangle_inverse { height: 160px; width: 170px; -webkit-clip-path: url(#shape); clip-path: url(#shape); -webkit-transform: translatez(1px) }
<svg width="0" height="0"> <defs> <clippath id="shape"> <path transform="translate(0.000000,163.000000) scale(0.100000,-0.100000)" d="m373 1197 c-355 -355 -363 -363 -363 -402 0 -39 8 -47 363 -402 355 -355 363 -363 402 -363 39 0 47 8 402 363 355 355 363 363 363 402 0 39 -8 47 -363 402 -355 355 -363 363 -402 363 -39 0 -47 -8 -402 -363z" /> </clippath> </defs> </svg> <img class='photo_rectangle_inverse' src='http://i.imgur.com/nr6kefg.jpg' /> <img class='photo_rectangle_inverse' src='http://i.imgur.com/dxah323.jpg' />
i cleaning svg path, seems way overly filled considering simplicity of shape. i've made myself , results in near enough exact same outcome lot less code.
* { padding: 0; margin: 0; } .photo_rectangle_inverse { height: 160px; width: 170px; -webkit-clip-path: url(#shape); clip-path: url(#shape); position: relative; -webkit-transform: translatez(1px) }
<svg width="0" height="0" viewbox="0 0 160 160"> <defs> <clippath id="shape"> <path d="m10,70 q0,80 10,90 l70,150 q80,160 90,150 l150,90 q160,80 150,70 l90,10 q80,0 70,10z" /> </clippath> </defs> </svg> <img class='photo_rectangle_inverse' src='http://i.imgur.com/nr6kefg.jpg' /> <img class='photo_rectangle_inverse' src='http://i.imgur.com/dxah323.jpg' />
Comments
Post a Comment