透明 PNG/GIF 雕刻出背后的背景图像
我正在设计一个网站,但在我测试过的所有浏览器中都遇到了透明度问题。
以下是我希望图像的堆叠方式(从最低 z-index 到最高):
背景图块 (JPG)
倾斜相框 (PNG) // 显然,因为这是倾斜的,所以侧面需要透明,才能让背景图块 JPG 通过
倾斜照片 (PNG) 显示 // 它位于相框内,其边缘是也是透明的,这应该让相框在照片周围显示(视觉上)
出于某种原因,我的照片的透明部分雕刻出了相框的部分内容,因此我直接看到了背景图块,而不是透过相框显示(JPG) 。我宁愿将照片和相框分开,因为我打算实现一个脚本,该脚本可以在页面刷新时随机化相框中显示的照片。
我已将我所做的示例上传到 http://jezenthomas.co.uk/temp
在我的示例中,我使用了 GIF,但我在使用 PNG 时遇到了同样的问题。
当问题解决后,我会将其从我的网络空间中删除,所以我希望我已经为可能遇到同样问题的其他人提供了足够彻底的解释。
I am designing a site and I'm having transparency issues in all browsers I've tested in.
Here's how I want my images to stack up, from lowest z-index to highest:
background tile (JPG)
tilted photo frame (PNG) // obviously because this is tilted, it'll need to be transparent on the sides to let the background tile JPG show through
tilted photo (PNG) // this sits inside the photo frame, and the edges of this are also transparent, which is supposed to let the photo frame display (visually) around the photo
For some reason, the transparent parts of my photo are carving out parts of the photo frame, so instead of the frame showing through, I'm seeing straight through to the background tile (JPG). I'd rather keep the photo and the photo frame separated because I intend to implement a script that randomises the photo that is displayed in the frame upon page refresh.
I have uploaded an example of what I'm doing to http://jezenthomas.co.uk/temp
In my example, I have used GIFs, though I experience the same problem with PNGs.
When the problem is fixed, I'll remove it from my webspace, so I hope I've explained it thoroughly enough for anyone else who might experience the same thing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的
元素与平铺背景图像具有相同的背景:)
您的 CSS:
Your
<span>
element has the same background as your tiled background image :)Your CSS:
您的重置 CSS 选择器将所有元素上的背景图像设置为
i/bg.jpg
。Your reset CSS selector sets the background image to
i/bg.jpg
on all elements.