Fixing div with absolute positioning being placed under image

爱⌒轻易说出口 提交于 2019-12-12 01:10:04

问题


I have an image and also a small container that I want to be placed on the container, but it sets this ".innerimage" below the image.

Do not suggest using top: xx; because in my actual project I have many divs with the same class and I can't use top or it will screw it up.

<div id="page">

    <div class="image">
        <img src="http://upload.wikimedia.org/wikipedia/commons/8/85/Black_300.jpg">
            <div class="innerimage"></div>
    </div>

</div>

回答1:


If I well understand your need and if you don't have to support IE7, maybe you could use the display:table and display:table-caption

I updated the JSFiddle with these CSS properties:

http://jsfiddle.net/ZhdMj/1/



来源:https://stackoverflow.com/questions/15800937/fixing-div-with-absolute-positioning-being-placed-under-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!