我已经建立了一个 jsfiddle 来展示我所尝试做的事情:
http://jsfiddle.net/MgcDU/3936/
#counter {
position: relative;
}
#over {
position:absolute;
left:33%;
top:43%;
}
猫的图像是我的背景图像,随着浏览器的大小而调整大小。
球形图像绝对定位在猫上方。我该如何让球形图像调整大小并保持在默认位置?
我已经建立了一个 jsfiddle 来展示我所尝试做的事情:
http://jsfiddle.net/MgcDU/3936/
#counter {
position: relative;
}
#over {
position:absolute;
left:33%;
top:43%;
}
猫的图像是我的背景图像,随着浏览器的大小而调整大小。
球形图像绝对定位在猫上方。我该如何让球形图像调整大小并保持在默认位置?
将您的#counter
div设置为display: inline;
,或添加一个具有display: inline;
属性的包装器,并将 #over
的max-width
设置为例如10%
(DEMO):
#counter {
position: relative;
display: inline;
}
#over {
position:absolute;
left:33%;
top:43%;
max-width: 10%;
}
position:fixed;
替代。 - Andrew