我想在网站上放一个大的(几乎全屏幕) alpha透明图像,但我有以下问题:
如果我只为透明区域创建PNG-8文件,为非透明区域创建JPG图像,我会考虑什么。用绝对的位置把东西移到适当的位置。有人做过这样的事吗?
或者另一个想法,但这是我真的没有经验的:是否有可能使用JPG图像,并将其与8位PNG中的alpha透明度结合起来?我的意思是使用JS、CSS3、画布或其他我以前从未使用过的东西?
这是我现在使用PNG-8的页面,但是它很大(700 kb),一些颜色丢失了。
http://ilhaamproject.com/sand-texture-2/
发布于 2011-09-22 00:11:19
我以前用过同样的JPG + PNG技巧,用的是大而透明的背景图像。把你的大照片切成两种长方形:
目标是获得尽可能多的图像细节保存与JPG。
接下来,您需要使用相对定位和绝对定位将所有内容重新组合起来:
<div class="bg">
<div class="content">
http://slipsum.com
</div>
<div class="section top"></div>
<div class="section middle"></div>
<div class="section bottom"></div>
</div>
.bg {
width: 600px; /* width of your unsliced image */
min-height: 800px; /* height of your unsliced image, min-height allows content to expand */
position: relative; /* creates coordinate system */
}
/* Your site's content - make it appear above the sections */
.content {
position: relative;
z-index: 2;
}
/* Define the sections and their background images */
.section {
position: absolute;
z-index: 1;
}
.section.top {
width: 600px;
height: 200px;
top: 0;
left: 0;
background: url(top.png) no-repeat 0 0;
}
.section.middle {
width: 600px;
height: 400px;
top: 200px;
left: 0;
background: url(middle.jpg) no-repeat 0 0;
}
.section.bottom {
width: 600px;
height: 200px;
top: 600px;
left: 0;
background: url(bottom.png) no-repeat 0 0;
}https://stackoverflow.com/questions/7507731
复制相似问题