开发者

Can i Add an image ontop a <div> without adding any html tag?

lets say we have

<div class="picture"><img class="picture_thumb" src="path" /> </div>

And i'd like to use CSS to add an image z-index higher to .picture (it's basically an magnifying glass Icon so I can see it on top of .picture_thumb)

Any chance?

开发者_JS百科

Thanks a lot

PD: it would be like instead of a background, a Front-ground -EDIT- An image so you can understand better

Can i Add an image ontop a <div> without adding any html tag?


There's no such thing as front-ground.

You'd have to do something like this:

<div class="picture">
  <img src="images/picture.jpg" alt="Picture" />
  <img class="magnifier" src="images/magnifier.jpg" alt="Maginfy" />
</div>

.picture {
  position: relative;
  width: 100px;
  height: 100px;
}

.magnifier {
  position: absolute;
  bottom: 0px;
  right: 0px;
  z-index: 1000;
}

You could also do it with javascript if you didn't want to add the magnifier image to each picture div.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜