2011-08-18 58 views
1

我想让徽标在调整窗口大小时“跟随居中背景(图片)的运动”。可能吗 ?我尝试了很多东西,但无法得到它。在调整窗口大小时将元素保持在相对于背景的位置?

背景

div.container{ width:1164px; height: 776px; margin:0px; border:none; line-height:150%;

background-image: url('background'); background-repeat: no-repeat; background-attachment:fixed; background-position:left:45px;top:20px;
}

标志

<img style="position:fixed;left:45px;top:20px;" src="/logo" width="205" height="234" alt="logo"/>

+0

您有链接到正在使用的位置吗?另外,如果您将徽标放在div容器中,那么遵循中心背景的运动,您的意思是什么,那么它将保留该div。此外,如果div“容器”是独一无二的,你可以考虑将它用作css id而不是class。 – Jason

回答

0

如果你想只horizo​​中心的内容,最后你可以尝试 div.container {margin:0 auto} 并将背景图像放在身体上,就像这样 body {background-image:url('background');背景位置:50%0px;}

相关问题