重叠的背景图像
我有一个带有使用 css 属性background-image 的背景图像的表格。在表中,我有一些使用 的图像。图像
表位于背景图像上方。我希望背景图像像文本一样覆盖图像
。这可能吗?
代码示例:
<style>
#content { background-image:url("background-image.jpg"); background-repeat:repeat-y}
</style>
<table id="content">
<tr>
<td>Some text.....text.....text
Image: <img src="quadrado.jpg" />
</td>
</tr>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您想要一个叠加层。仅使用 CSS 无法做到这一点。
但您可以通过添加如下样式来接近:
.
要获得更多真正的叠加层,您需要将其编码到 HTML 中或使用 JavaScript 动态添加它。
请查看此页面。它使用 javascript 为具有
OverlayTheBackground
类的块生成叠加层。还有应该生成叠加层的 jQuery 插件。
也许可以发布一张你想要的图片。但是,听起来就像您需要做的就是添加以下样式:
Sounds like you want an overlay. You can't do that with just CSS.
But you can come close by adding styles like so:
.
For more of a true overlay, you'd need to code it into your HTML or use javascript to add it on the fly.
Take a look at this page. It uses javascript to generate overlays for blocks with the class
OverlayTheBackground
.There are also jQuery plugins that are supposed to generate overlays.
Perhaps post a picture of what you want.But, it sounds like all you need to do is add this style:
我不确定我是否完全理解这个问题,但是如果您希望背景图像通过部分内容图像显示,您将需要使用 png 或 gif,因为它们允许图像的某些部分透明,而 jpg 则不允许。
I'm not sure I understand the question completely, but if you want the background image to show through parts of the content images, you will need to use png's or gif's as they permit parts of the image to be transparent and jpg's don´t.