Responsive images positioned over image

天大地大妈咪最大 提交于 2019-12-17 22:35:52

问题


I have setup a jsfiddle of what i'm trying to do:

http://jsfiddle.net/MgcDU/3936/

#counter {
    position: relative;
}
#over {
    position:absolute;
    left:33%;
    top:43%;
}

The image of the cat is my background image which resizes as the browser resizes.

The ball image is absolutely positioned over the cat. How can I get the ball image to resize and stay in the same position as it is my default?


回答1:


Set your #counter div to display: inline; or add a wrapper with display: inline; and set the max-width of #over to for example 10% (DEMO):

#counter {
    position: relative;
    display: inline;
}
#over {
    position:absolute;
    left:33%;
    top:43%;
    max-width: 10%;
}


来源:https://stackoverflow.com/questions/16363029/responsive-images-positioned-over-image

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