I have a PNG 500×500 pixels image with transparent background, sadly the image has quite a lot of transparent space on top/bottom/left/right side so when I use it in my HTML it looks like it has huge margin or padding because of that transparent space.
The actual part of the image I want to use is the center 250×250 pixels, so that leaves 125px empty transparent space on every side. Is it possible to CSS to somehow make it look as if the sides of the image are cropped?
The images are coming from an API so I can’t crop the sides in software like Photoshop.
Here’s an example of an image I’m working with – http://raw.communitydragon.org/pbe/game/assets/loadouts/regalia/crests/prestige/prestige_crest_lvl_200.png
2
Answers
I was able to crop it using it as a background.
You can check it here: https://codepen.io/bhanusinghR/pen/jONBOJa
You could either use a background as it was already suggested, or give the image a container to clip it: