图像在图像CSS [英] Image over Image CSS

查看:83
本文介绍了图像在图像CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网页,我试图将一个png(按钮)放在gif文件上。
当页面呈现时,它使png文件显示在gif文件之后或之下。
我尝试使用和标签,但都不工作。我也试过使用各种CSS填充,对齐等,但它似乎不工作。
是否有一种方法(代码)让图像出现在图像顶部?

I am creating a webpage and I am trying to put a png (buttons) over gif files. When the page renders, it makes the png file appear after or under the gif file. I tried using and tags but neither work. I have also tried using various CSS padding, alignments etc. but it doesn't seem to work. Is there a way (code) to get images to appear on top of images?

推荐答案

页面具有特定的堆叠顺序。如果您没有明确设置它们,那么它将根据DOM中的顺序进行堆叠。

Each element in a page has a particular stacking order. If you do not set them explicitly then it will be stacked in accordance to the order in DOM.

您可以通过设置属性

z-索引

z-index值越高,元素的堆叠顺序越高。

The higher the z-index value goes the higher will be the stacking order for the element.

如果您可以将gif图片设置为单元格的背景,则

If you can set the gif image as the background of a cell then

background-image

。首先将gif图像设置为单元格的背景,并将png按钮放置在单元格中,并将其放置在单元格内。

property will be the best one. First set the gif image as a background to the cell and place the png button in the cell and position it inside the cell.

这篇关于图像在图像CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆