开发者

Creating a transparency mask for html

开发者 https://www.devze.com 2023-01-15 01:01 出处:网络
Has anyone come across an effective way to mimic Webkit\'s -webkit-mask-box-image: url(filename.png) functionality?

Has anyone come across an effective way to mimic Webkit's

-webkit-mask-box-image: url(filename.png)

functionality?

I'm trying to use non-square animated elements, and would prefer not having to do the masking on server开发者_如何学运维-side.

I'm set on supporting at least Gecko and Webkit, but if I can manage Opera and IE, that would be a bonus.


After Googling a lot, seems there is no way to do this with anything other than webkit at the moment. Just pre-mask your images in Photoshop for now :)


Put a div containing transparent images with higher z-index absolutely positioned over the top of the animations?

Just a thought, might be completely useless for what you need.

<div class="animation">
</div>
<div class="mas">
</div>

.animation{height: 200px; width: 200px; position: absolute; top: 0; left: 0;}
.mask{height: 200px; width: 200px; position: absolute; top: 0; left: 0; z-index: 10; background: transparent url('mask.png') 0 0 no-repeat;}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号