使用谷歌地图作为背景? [英] Using google maps as a background?
问题描述
好了,所以我试图实现谷歌地图作为背景,以我的网站。但是,当我尝试使用这个code把文本在它:
Okay so I have tried to implement Google Maps as a background to my website. But when I try to put text over it using this code:
.content{
z-index:0;
background-color:fffff;
position: absolute; top: 0; left: 0;
width: 900;
height: auto;
margin-right: auto;
margin-left: auto;
}
这是给我用它显示它在地图上,这正是我想要的顶部地图一个错误,但它不与工作与利润率出于某种原因。我所有的code是在这里: http://pastebin.com/uz6wwtYZ
谁能帮我,因为我想在网页,地图作为背景的中心内容。
Can anyone help me because I want the content in the center of the webpage and the map to act as the background.
感谢。
推荐答案
尝试调整的顶部和当一个项目设置到一个绝对位置留有余量,而不是:
Try adjusting the top and left instead of margin when an item is set to an absolute position:
.content{
z-index: 100;
background-color:fffff;
position: absolute; top: 100px; left: 100px;
width: 900;
height: auto;
margin-right: auto;
margin-left: auto;
}
希望帮助?可能还需要将其设置为我在上面已经做了更高的z-index值。
Hope that helps? Also might want to set a higher z-index value as I have done above.
如果你想要它,平行自动边距值居中,但也绝对定位的,我不认为你可以做到这一点。
If you want it horizontally centered with auto margin values but also absolutely positioned, I don't think you can do that.
您可以不是给你的内容的绝对宽度和抵消left属性试试这个:
You can try this instead by giving your content an absolute width and offsetting the left property:
.content{
width: 500px;
z-index: 100;
background-color:fffff;
position: absolute; top: 100px; left: 50%;
height: auto;
margin: auto;
margin-left: -250px; /* half the value of the width */
}
下面是一个JS小提琴一个链接,使用您的code: http://jsfiddle.net/ 4FLKt / 1 / 似乎是工作的罚款。
Here's a link to a JS Fiddle that uses your code: http://jsfiddle.net/4FLKt/1/ Seems to be working fine.
米奇。
这篇关于使用谷歌地图作为背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!