如何在
问题
我需要在表格元素上放置一个透明的 png 图像。
澄清
我所说的“放置”是指图像将像层或贴纸一样堆叠在桌子顶部,而不是垂直位于其上方。换句话说,我希望图像在 z 轴上向前移动,而不是在 y 轴上向上移动。
上下文
我有 8 x 6 单元格表。单元格不包含文本,但包含背景颜色以暗示值。出于美观原因,我想在桌子上放置一个白色轮廓设计。
我尝试过
将表格包装在 div 中,将图像应用为背景,然后尝试将其在 z 索引上向前移动。
HTML 基本演示:
<div class="table-foreground">
<table>
<tr>
<td>
</td>
</tr>
</table>
</div>
随附 CSS 基本演示:
td{
background-color:#000;
}
div.table-foreground{
background-image:url(images/table-foreground.png);
position:relative;
z-index:5;
}
结果
注意:科学家要求我提供尝试代码的结果.
从视觉上看,什么也没有发生。我推测以 png 图像为背景的 div 位于我的桌子下方。这表明我的代码还不够。
The problem
I need to place a transparent png image over a table element.
Clarification
By "place" I mean the image will be stacked on top of table like a layer or sticker rather than vertically above it. In other words, I want my image to move forward on the z axis rather than moving upward on the y axis.
Context
I have 8 x 6 cell table. The cells do not contain text but do contain a background color to imply a value. I want to place a white silhouetted design over the table for aesthetic reasons.
What I've tried
I've tried wrapping the table in a div, applying the image as a background and then tried bringing it forward on the z-index.
Basic demonstration of HTML:
<div class="table-foreground">
<table>
<tr>
<td>
</td>
</tr>
</table>
</div>
Basic demonstration of accompanying CSS:
td{
background-color:#000;
}
div.table-foreground{
background-image:url(images/table-foreground.png);
position:relative;
z-index:5;
}
The result
Note: thescientist requested that I provide the result of my attempted code.
Visually, nothing happens. I speculate that the div with the png image as it's background is beneath my table. This suggests that my code is not sufficient.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)