0

I have a website created in MVC4.

I have an image. And I only want to show the shape (an arrow) of the image. And I don't want to show the rest of the image (the background).

enter image description here <= only the white background of the arrows has to be disappeared.

How do you do that?

I tried this, but with this the whole image will disappear, in stead of a part of it:

.images_top {
    width: 30px;
    text-align: center; 
    vertical-align: top;
     -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
       filter: alpha(opacity=0);
       opacity:0;
}
user1531040
  • 2,143
  • 6
  • 28
  • 48

3 Answers3

1

First of all I think you can use a PNG with alpha channel.

If this is not possible look at this tutorial about how to clip images by using the SVG clip-path. http://www.html5rocks.com/en/tutorials/masking/adobe/

Even though it is possible only in recent browsers.

B3rn475
  • 1,057
  • 5
  • 14
1

Use PNG Images for Transparent Background. You can use any online converter to convert your image to PNG.

Muzamil Rafique
  • 147
  • 1
  • 12
0

Apart from the now better supported PNG (and PNG8 with better fallback-support (looking at IE) and a (configurable) transparent color (index from the pallette) instead of alpha, pretty much just like GIF), there is also GIF which has 'always' been supported (and is no longer cumbered with legal issues, which were only due to it's LZW based compression-algorithm, that one can bypass).

Because of the lack of alpha-channel, creating nice transparent PNG8 and GIF images (without the dreaded overly visual grainy (often white) borders) is somewhat of a true art, infact pixel-art.
The trick is to touch-up the borders between color and transparancy by hand AND to set the image's background-color (when rendering from alpha channel to single color-index transparancy) to the average color of the background the images are going to be used against.

The idea of fatter png's is that they have alpha-channels which will give you (for clear example) nice shades (if you had applied such an effect) that will blend with any background. Now with modern browsers, this works pretty nice (and doesn't require the pixel-art). Pixel-art PNG8/GIF can still have it's place though, for base64 encoded ui-elements, usually small icons.

GitaarLAB
  • 14,536
  • 11
  • 60
  • 80