I would like to make an rhombus shaped image, with border and padding.
I’ve managed to make the image in a rhombus shape, but haven’t succeeded in making a border with padding around it.
I’m using elementor builder and looking for a solution that will not envolve js coding, only css. is there a way??
this is what I’m trying to achieve:1
2
Answers
You can use the
clip-path
property to set the border for your rhombus image.Here is the snippet link: https://jsfiddle.net/nk8f5pyg/4/
HTML:
CSS:
Parent Div:
Image tag:
Update the image tag’s position to relative so that we can reposition the element
Aligned the image center to the parent using
left
andtop
propertiesCan I use: https://caniuse.com/#search=clip-path
Additional useful link:
https://bennettfeely.com/clippy/
https://css-tricks.com/clipping-masking-css/
Here is an idea with one element: